[Zope] Memory leak

Jean-Francois.Doyon@CCRS.NRCan.gc.ca Jean-Francois.Doyon@CCRS.NRCan.gc.ca
Tue, 4 Feb 2003 15:14:09 -0500


Mark,

Indeed, in my case, the memory leak got MUCH worse after installing
LeakFinder.  I made the educated guess that this was due to the fact that
references no longer being lost, memory usage was being allocated
differently or something like that? (When references are lost, memory might
get overwritten?) I think I posted a question to the list about that, but no
one seemed to have anything to contribute to that ... So either I was right,
or it was so weird no one knew :)

Let me know what you find, I'm inetersted to see if we maybe experience
problems based on the same root cause.

J.F.

-----Original Message-----
From: Mark Thomas [mailto:markt@kooee.com.au]
Sent: Monday, February 03, 2003 10:30 PM
To: Jean-Francois.Doyon@ccrs.nrcan.gc.ca
Cc: zope@zope.org
Subject: Re: [Zope] Memory leak


Thanks J.F., for the quick and relevant response.  I had seen something 
about LeakFinder but was avoiding it because I had seen reports that it 
had increased some problems.  Your experiences seem to indicate that it 
may just have given the appearance of making matters worse, but in fact 
it was just showing more accurate ref counts.

I'll install it and see what I come up with!

Mark Thomas


Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote:

>Mark,
>
>I've also been struggling with Memory Leaks in Zope, and not having much
>luck with it either. The behavior was much the same as yours, only over a
>longer period of time (My Zope will last up to 8 or 10 days).
>
>I'm using 2.5.1 however.
>
>First thing I would recommend would be to install the LeakFinder product.
>It was instrumental in my finding more about my leak.  Looks like the
>LeakFinder, somehow imporves the refcount, and after installing it, you may
>get better refcounts that will give you a clue of what's going on.  In my
>case, where the DateTime refcounts never were a problem before, with
>LeakFinder, I learned that I was leaking DateTime objects through lost
>references it seems.  I'm also pretty sure it's got something to do with
the
>ZCatalog, since it's the one that instantiates these most. You may have
been
>reading my previous e-mails.
>In my case though I think it's got to do with the searching, not the
>indexing.
>
>As far the request.set, apparently that's an "old" issue that probably is
no
>longer, but I removed them as best I could from my code ... didn't change
>much anyways. This was due to concerns with the fact that the request
object
>is so intensively used and passed around internally, keep track of
>references may have been a problem at some point.
>
>Right now I've got my eyes on this piece of code:
>
>from random import choice
>
>selecteditem = choice(context.portal_catalog.searchResults(
>meta_type='Featured Item', includeinrotation = '1',
>review_state='published'))
>
>return selecteditem
>
>Which I could see how it might loose references if not done right, I'll be
>running tests on this soon.
>
>This type of behavior seems to be experienced by a range of people with
>various apparent causes ... It would be nice if we could put our heads
>together on this.
>
>Anyways, sorry, I got carried away :) First: Setup LeakFinder :)
>
>Cheers,
>J.F.
>