[ZODB-Dev] Iterating over large ZODB

Dieter Maurer dieter at handshake.de
Wed Feb 9 17:19:07 EST 2005


Chris Withers wrote at 2005-2-9 10:12 +0000:
> ...
>while True:
>    object = stack.pop(0)
>    print object.getPhysicalPath()
>    print object.meta_type
>    if object._isPrinicipiaFolderish:
>       stack.extend(object.objectValues())
>    if not stack:
>        break
>
>...but I'm worried that will drag all the objects in the ZODB into memory.
>
>Now, given the ZODB in question is Zope.org, that's something i'd like 
>not to do ;-)
>
>How can I dump objects out of memory every 1000 or so times round the loop?

You can call the "Connection.cacheGC" method to perform
a cache garbarge collection at appropriate places.

-- 
Dieter


More information about the ZODB-Dev mailing list