[ZODB-Dev] zodb-3.4.0 leaks ZEO.cache.Entry objects?
Tim Peters
tim at zope.com
Wed Aug 3 16:42:12 EDT 2005
[Tim]
> ...
> If you have (or can create) a small, self-contained script showing the
> problem, that would be the most effective way to make progress.
Hmm! This appears to be enough:
import sys
import random
import logging
logging.basicConfig()
import ZODB
from ZODB.config import storageFromString
from ZEO.cache import Entry
from BTrees.OOBTree import OOBTree
import transaction
config = """\
<zeoclient>
server localhost:4141
cache-size 100KB
client glimmer
</zeoclient>
"""
st = storageFromString(config)
db = ZODB.DB(st)
cn = db.open()
rt = cn.root()
if "tree" not in rt:
rt["tree"] = OOBTree()
transaction.commit()
tree = rt["tree"]
N = 1000
for i in xrange(N):
j = random.randrange(1000000000)
tree[j] = str(j)
transaction.commit()
print sys.getrefcount(Entry),
print
db.close()
The refcount on Entry keeps growing. I suspect, but don't yet know, that
this is because FileCache._makeroom()'s
if e is not None:
self._evictobj(e, size)
should have another line:
if e is not None:
del self.key2entry[e.key]
self._evictobj(e, size)
It would account for the refcounts on Entry and tuple continually growing
(each Entry contains a unique-to-it tuple). It would not account for the
refcount on list growing.
More information about the ZODB-Dev
mailing list