[ZODB-Dev] memory problem

Greg Bakken greg.bakken@bioreason.com
Mon, 03 Dec 2001 16:46:12 -0700


Hi.

I am trying to develop an application that uses ZODB for persistent
storage.  I haven't had a problem in generating ZODB type files, but I
am running in to a problem when I access these files.

Basically, I have created files in the following manner:

D = PersistentMapping()
for i in range(x):
     D[i] = PersistentMapping(initialize with some dictionary)

When I access the ZODB again, I do something like the following:

for i in range(x):
    C = D[i]
    print C.items()

What seems to be happening is that the iteration over the values in D
goes so fast that all the objects are still in cache when the process
completes, so I am back to where I started with everything in memory at
once.  I have tried changing the cache_deactivate_after when
initializing the DB, but that didn't seem to make a difference. 
Basically, I would like to be able to acces C.items() and immediately
remove that from cache so that I won't be taking up that memory.  It
would be fine if 10 or 20 objects were in memory at one time, but I
cannot seem to get that to happen.

Is there a straightforward way to make the information pulled from a
ZODB basically "throw-away"?  Any help you could provide, or pointers to
other places to learn more, would be greatly appreciated.

Greg
Greg.Bakken@bioreason.com