[ZODB-Dev] [Patch] (was: [Bug] Leaking pickle cache references --> potentially huge memory leaks)

Dieter Maurer dieter at handshake.de
Tue Nov 11 12:57:20 EST 2003


Dieter Maurer wrote at 2003-11-11 00:36 +0100:
 > ZODB 3.1, Python 2.1.3
 > 
 > Yesterday, I reported a problem with temporary connections related
 > to the pickle cache.
 > ...
 > Usually, persistent objects are deallocated through a call
 > to "Per_dealloc" (defined in "cPersistence.c").
 > "Per_dealloc" calls "deallocated" and then releases the
 > cache reference.
 > 
 > Some older classes (especially "BTree") use the macro "PER_DEL" for
 > deallocation. It is defined in "cPersistence.h" to
 > be "cPersistenceCAPI->deallocated".
 > "cPersistence.c" initializes "cPersistenceCAPI->deallocated"
 > to "allocated" rather than "Per_dealloc".

Affected are "BTree" and the newer "BTrees" classes.

 > As a consequence, the cache reference is not released.
 > Each deallocation of such a persistent object leaks
 > a reference to the pickle cache.
 > A single such leak is sufficient to make the pickle cache
 > uncollectible leading to a potentially huge memory leak.
 > 
 > 
 > Later in the day, I will see whether I can fix this bug.

Patch attached.

-- 
Dieter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zodbleaks.pat
Type: application/x-patch
Size: 2582 bytes
Desc: Patch to reduce various kinds of leaks due to cyclic
	structures
Url : http://lists.zope.org/pipermail/zodb-dev/attachments/20031111/da9f4a5f/zodbleaks.bin


More information about the ZODB-Dev mailing list