[ZODB-Dev] Estrange behaviour with BTreeFolder2

Santi Camps scamps at earcon.com
Wed Apr 1 05:46:01 EDT 2009


Hi all

I'm having memory problems and, after some debugging with gc, I see
some estrange behaviours with BTreeFolder2 (or with BTrees itself, I'm
not sure).   I've a BTreeFolder2 with 40000 objects, more o less.
Some of them are emails.   Just accessing the container, about 700
mails are loaded in memory !!

from AccessControl.SecurityManagement import newSecurityManager
from Testing.makerequest import makerequest
user = app.beta.acl_users.getUser('manager').__of__(app.beta.acl_users)
newSecurityManager({}, user)
app = makerequest(app)
km = app.beta
km.portal_repository._tree
import gc
objects = gc.get_objects()
objects2 = [obj for obj in objects if getattr(obj, '__class__', None)]
emails = [obj for obj in objects2 if 'mail' in obj.__class__.__name__.lower()]
print len(emails)
697

Following gc references, I see this mails are referenced from a
OOBucket, that is referenced by another OOBucket, ... and some of them
are referenced from persistent.PickleCache (instead I've configured
cache-size = 0 in zope.conf).   Seems that some buckets and its
referenced objects are readed during btree loading.   So, the garbage
collector never clears this from memory, and after some hours of
intensive work, the server RAM is finished

Is that normal ?  I'm making some mistake ?  Anybody knows any way to solve it ?

Thanks in advance
-- 
Santi Camps (Earcon S.L.)
http://www.earcon.com
http://www.kmkey.com


More information about the ZODB-Dev mailing list