> ...
> 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

import ZODB
from ZODB.config import storageFromString
from ZEO.cache import Entry

from BTrees.OOBTree import OOBTree
import transaction

config = """\
    server localhost:4141
    cache-size 100KB
    client glimmer

st = storageFromString(config)
db = ZODB.DB(st)
cn = db.open()
rt = cn.root()

if "tree" not in rt:
    rt["tree"] = OOBTree()
tree = rt["tree"]

N = 1000
for i in xrange(N):
    j = random.randrange(1000000000)
    tree[j] = str(j)
    print sys.getrefcount(Entry),

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.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to