[Zope] Zope leaking memory?

Chris McDonough chrism at plope.com
Sun Sep 12 10:49:04 EDT 2004


I've noticed what I believe are "request leaks" if any variety of CMF is
involved in a request though I haven't tracked this down.  The symptoms
are that every request causes the HTTPRequest class to have its
reference count increased by one, plus a bunch of other objects are
leaked because the request that was leaked apparently continues to hold
on to references to them.

This may or may not be what you are seeing.

If you want to track something like this down, there is really no
shortcut.  My strategy (which I've never successfully used to actually
fix a leak, mind you! ;-) is this:

- Confirm that bare Zope doesn't leak by testing refcounts before
  and after you load the quickstart page several times (remember
  to clear the ZODB cache before you start hitting the site
  whenever trying to test refcounts).  Look at the number of
  references to all classes in the Debug tab.  These references
  should not normally grow on every request.

- Do same for one of your "domain" objects.

If you see leakage when trying this against a method of one of your
domain objects, a binary-exclusion method is usually the only way to pin
down the leak.  Prevent half of the code that gets run when your domain
object method is called from running.  If you still see the leak, the
leak happens in the code you didn't prevent from running.  If you did,
the leak happens in the code that ran.  And so forth.  It's tedious and
time-consuming, which is probably why I've never successfully used it to
fix a leak. ;-)

- C


On Sun, 2004-09-12 at 01:33, Dennis Allison wrote:
> Pound-current (V 1.7+)
> Zope 2.6.4
> Python 2.3.4
> RH 7.3
> Dual Athalon processors
> 
> Occasionally, I see Zope gathering very large amounts of real memory.
> Normally buffering and the like seems to stabalize at around 500MB on a
> 4GB memory dual processor machine, but occasionally grows to 2.5GB or
> more.  At the same time, CPU usage tends to fully occupy one of the
> processors for the threads holding all the memory.  Clearly there is a
> problem.  Any hints as to where to track down the problem?
> 
>  
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 



More information about the Zope mailing list