pickle: huge memory consumption *during* pickling

Hans Georg Krauthaeuser hgk at et.uni-magdeburg.de
Fri Nov 12 03:23:02 EST 2004


Nick Craig-Wood wrote:
> ....
> You've probably got lots of instances of a single class...  We managed

You are right. My data are class objects taken from a c++ class (via swig).

> to 1/3 the memory requirments in a similar situation by using new
> style classes (inherit from object) and defining __slots__ for just a
> single class!

Interesting, I didn't noticed __slots__ before.

In the swig-wrapper I found that my object are inherited from _object 
and that is

import types
try:
     _object = types.ObjectType
     _newclass = 1
except AttributeError:
     class _object : pass
     _newclass = 0
del types

So, this are new style classes.

Now, I have to see how to get swig to generate __slots__ ...

Thanks,

Hans Georg



More information about the Python-list mailing list