I dont think I understand the issue. You create some persistent objects. You have references to those objects in a list. You store the list in a persistent object too. You restart and you still have references to those objects. This isn't a leak, AFAICT. ----- Original Message ----- From: "Christoph Wierling" <wierling@molgen.mpg.de> To: <tpassin@mitretek.org> Cc: <zope@zope.org> Sent: Wednesday, January 16, 2002 5:19 AM Subject: Re: [Zope] memory leak in a very simple product. Way?
[Thomas B. Passin]
[Christoph Wierling]
I've writte a very simple product which creates 100 simple objects (testProd class instances) and each of these objects has a
list-attribute
which contains 200 other objects (item class instances). (Please find the code at the end of this mail.) By starting the addTestProd-function I create 20000 references to item objects, as the Zope-debug option as well as the leakFinder-product tell me. But I'll never get rid of these references and earlier or later I'll run out of memory.
Could anybody explain me, way this simple product is leaking like a sieve? And how I can get rid of the references?
here is the code:
...
class testProd(SimpleItem.SimpleItem): """ testProd docu """
meta_type = 'testProd'
def __init__(self, id, title = ''): self.id = id self.title = title
self._tree = []
for i in xrange(200): n = item(str(i),i) tree = self._tree tree.append(n) self._tree = tree
I think you really want to do this:
tree = [] for i in xrange(200): n = item(str(i),i) tree.append(n) self._tree = tree
Thanks for the suggestion. Your code does about the same as my did - it also reproduces the 20000 references to objects of the item-class. And I also don't get rid of the 20000 references. I tried it! :-(
christoph
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )