[Zope-dev] find unused objects: hopefully the last misunderstanding...

Jens Vagelpohl jens@zope.com
Fri, 30 Aug 2002 08:10:36 -0400


extremely expensive. you would have to...

- assemble a list of all objects IDs in the ZODB

and then...

- parse all contents of all objects and check against that ID list.

you would probably need a little counter for every single ID that gets 
incremented upon finding its ID referenced, and all those that are left 
over with the counter at 0 in the end would probably be candidates for 
removal.

this schema will fall down the moment your object IDs are not unique 
across the whole ZODB. besides, every object is potentially different 
in how you access and read its "contents".

if your whole intent is to have a "cleaner ZODB" and there is no 
pressing reason to do this cleanup, i would just forget about it.

jens

On Friday, Aug 30, 2002, at 07:48 US/Eastern, THerp@apriori.de wrote:

>
> * > Starting at root, check all objects  if they are referenced,
> * > and produce a list of those which are not, for cleanup purposes.
>
> * Packing the database cleans up in this manner.
>
> Oh well. Third try:
> I know about the 'pack database' button. Garbage collection of this
> kind is not my problem.
>
> I have lots of scripts, dtml methods etc. everywhere which are
> perfectly well-known to the ZODB, nothing wrong with that, but which
> are simply not used by me anymore. No usage from other scripts nor
> methods nor documents. And these buggers I'd like to find.
>
> Finally unmistakeable?
>
> Tobias Herp