[ZODB-Dev] Does the ZODB eat memory?

Ulla Theiss u.theiss at eurodata.de
Tue Apr 22 16:46:21 EDT 2003


Hello list,

in our product (an additionally in an other process) we use stand alone
ZODB-Storages.

Opening an closing the ZODB several times after some operation, the
memory of the python process
increases.

We have reduced the problem to the following code. Performing it, the
memory increases from little bit less
than 4.000 KB to about 28.000 KB.

Have we forgotton to close anything, or made anything else wrong? Has
anybody an idea how to fix or work
around the problem?

In the first run a little ZODB is created. Afterwards it's just accessed
and of cource opened and closed.
---------------------snip-----------------------snap-------------------------------------------------------

from ZODB import FileStorage, DB, Persistent

class Elem(Persistent):
    def __init__(self, e):
        self.e = e

    def clone(self):
        return Elem(self.e)

def create():
    print "filling database"
    root["anchor"] = []
    print "and filling it"
    for i in range(1, 100):
        root["anchor"].append(Elem(i))
    get_transaction().commit()        

for i in range (1, 1000):
    storage=FileStorage.FileStorage("TestZODB.fs")
    db = DB(storage)
    print "Open"
    connection = db.open()
    
    root = connection.root()

    if (not root.has_key("anchor")):
       create()
    anchor = root["anchor"]

    print "Close"
    connection.close()
    db.close()
    storage.close()

---------------------snip-----------------------snap-------------------------------------------------------
Bye the way: We run it in the following environment:

Zope Version    (Zope 2.6.0 (binary release, python 2.1, win32-x86),
python 2.1.3, win32) 
Python Version  2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)] 
System Platform win32 

Many thanks in advance,
Ulla.




More information about the ZODB-Dev mailing list