[ZODB-Dev] [Bug] Leaking pickle cache references --> potentially
huge memory leaks
Dieter Maurer
dieter at handshake.de
Mon Nov 10 18:36:34 EST 2003
ZODB 3.1, Python 2.1.3
Yesterday, I reported a problem with temporary connections related
to the pickle cache.
I think, I found the problem. It is not restricted to
temporary connections but can affect all connections.
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".
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.
I expect that the cache reference should be released
in "deallocated" rather than in "Per_dealloc".
--
Dieter
More information about the ZODB-Dev
mailing list