[Metakit] memory leak?

Jean-Claude Wippler jcw at equi4.com
Sun Jan 22 21:11:33 CET 2006


zooko at zooko.com wrote:

> This Python script eventually consumes all available memory and  
> dies.  Is this
> a bug?
[...]
> import metakit, os
>
> store = metakit.storage("leakcheck", 1)
> db = store.getas("test_db[k:B]")
>
> while True:
>     k = os.urandom(20)
>     db.append(k=k)
>     db.delete(db.find(k=k))

No.  It's because all changes are buffered in memory until commit.   
To avoid it, insert "db.commit()", say every 100,000 iterations.

-jcw


More information about the Metakit mailing list