[Zope] Memory Leak in Session Data Container
dieter at handshake.de
Tue Apr 11 16:14:51 EDT 2006
Andy Yates wrote at 2006-4-10 12:43 -0500:
>Fortunately, I have an easy way to reproduce the problem and even better
>I've found a work around. My hope is that the work around will lead
>somebody more familiar with the innards of Zope to where the problem is
I will look into this within the next days (in Zope 2.8.1, however).
>To me it looks like data placed in the session object are not getting
>deleted when the session object expires. Anything placed in a session
>object is essentially leaked. When the onDelete script explicitly
>removes the contents of the session data object the memory leak stops.
>Comment? Questions? Fixes? ;-)
The ZODB cache may keep your session objects (and thereby its
As you probably know, each ZODB connection has an associated
cache containing the recently accessed objects.
Objects in the cache can be ghosts (they contain no data)
or real objects. Ghosts disappear from the cache as soon
as the last reference in the application is deleted.
For real objects, however, the cache holds an extra reference
and thereby prevents the object release. For the storage,
an object held by the cache looks exactly equal to an object
held be the application. It cannot get rid of it.
You can try to flush (minimize) the caches associated
with the temporary storage and see whether this releases the memory
(the release may be postponed, as the "TempStorage" performs
garbage collection only at certain times).
If this should be your problem, you can reduce the size
of the ZODB caches.
More information about the Zope