[Zope] memory leak in a very simple product. Way?

Max M maxm@mxm.dk
Wed, 16 Jan 2002 18:20:47 +0100


Christoph Wierling wrote:


 > Yes, the item() objects are persistent. And if I do recursive 
creation and
 > deletion of the objects which contains the list with the persistent 
item()
 > objects the references to the item objects are still growing.
 > I just made the item objects not persistent, and it seems to work, so no
 > growing references.
 >
 > So I wonder way the reference counter for persistent item objects is 
still
 > growing by the recursive process of creation and deletion.


If your item is subclassing persistent you should expect them to stay in 
the zodb. And then you should not add them to a list in your own 
product, but create a subclass of ObjectManager and use the _setObject() 
method to add the item instances.

Else your item class should not subclass persistent.

If you want to do it your way by adding item instances to a list in your 
product you should also be aware that every time your product is 
changed, or even one of the item instances, the whole object is written 
to the Data.fs again. Leading to a bloated Data.fs ... if you don't pack 
it regularly.

But doing something like that with that many objects is the wrong way to 
use the zodb.


regards Max M