[ZODB-Dev] Freeing Memory
Steve Alexander
steve@cat-box.net
Mon, 17 Sep 2001 13:21:56 +0100
Chris Withers wrote:
> Hi,
>
> After I've done a get_transaction().commit(), how can I get a FileStorage to
> free the entire contents of its Object Cache and get python to free up as much
> memory as possible?
>
> I've tried calling zodb.pack(time()), zodb.cacheMinimize(0), and gc.collect()
> (which returned 0) but none seem to make a dent on the memory the python process
> is consuming. Well, zodb.pack(time()) did but that is so slow, surely there must
> be a better way.
In one of my scripts, I call cacheMinimize(3) on the _p_jar that I've
been reading lots of data from.
For example, if I've been reading items from a BTree to export them to
an xml file, every so often I do this:
get_transaction().commit(1)
btree._p_jar.cacheMinimize(3)
It works for me!
--
Steve Alexander
Software Engineer
Cat-Box limited