[Zope] memory leak?
Peter Bengtsson
mail at peterbe.com
Thu Jun 10 13:55:06 EDT 2004
LeakFinder might still not work with Zope2.7.0 but let my advice that
the most common memory leaks are huge lists with big objects.
Do you have any functions that create lists of either *many* instances
or instances that refer to objects which take up a lot of memory.
I had a few memory leaks when I did some custom sorts on lists of
objects of type Photo.
I've also experienced memory leaks in External methods when creating
lists filled with non-persistant instances; something like this:
class SearchResult:
def __init__(self, brain):
self._brain = brain
def showURL(self):
return self._brain.url()
def MyExternalMethod(self, # to get the whole zope tree
searchterm):
found = self.DoFindSomething(searchterm)
results = []
for each in found:
results.append(SearchResult(each))
return results
This should work with python's garbage collection but it's code like
this that is risky. I don't know why but it just is.
Paul Winkler wrote:
> On Thu, Jun 10, 2004 at 09:18:22AM +0200, Einar N?ss Jensen wrote:
>
>>I'm Running Zope 2.7.0 and python 2.3.3
>>on Debian with kernel 2.6.4
>>
>>I'm experiencing a rather anoying memory leak (?) wich causes the need
>>of a restart of zope once a week or so.
>>something in my zope causes the swap-partition to fill up (1,5 Gig), and
>>eventually zope will stop responding. When I restart zope, Everything is
>>back to normal, and the the swap partition slowly starts growing again.
>>
>>I have a sneaking suspicion that this is caused by some External methods
>>(we are using a lot)
>>
>>So: How may I track memory usage in zope, particulary: How can I find
>>out wich object is "gun on the run".
>
>
> google for LeakFinder.
> I have not used it but it's the most common recommendation
> I've seen on this list...
>
--
Peter Bengtsson, http://www.peterbe.com
More information about the Zope
mailing list