[Zope3-Users] unregister, delete and pack, still no gc?

Roger Ineichen dev at projekt01.ch
Tue Dec 23 08:46:25 EST 2008

Hi Roy

> Betreff: [Zope3-Users] unregister, delete and pack, still no gc?
> Hi Folks,
> I have either stumbled on a storage leak in the ZODB, or I am 
> missing something in my understanding of registration.
> Briefly, if I add a folder to the ZODB, make it a site, then 
> unregister it, delete it and pack the ZODB, I see the ZODB 
> increase in size.Each time I run the tests, the ZODB keeps 
> growing (by about 7KB). I restarted the ZODB to see if it 
> would help, but no!
> Here are my exact steps:
> 1. add a Folder
> 2. make a the folder a site.
> 3. register the folder (unnamed utility of type ISite) 4. 
> remove the registration from the "registrations" tab.
> 5. delete the folder.
> 6. pack the ZODB.
> I have also attached a selenium test that performs all of this.

This topic is on my todo list since a very long time. There is
defently something wrong with the concept or at least how we use it.

Here are some of my guesses.

I think the problem is related to the deep of object references
the carbage collector will follow. The carbage collector only looks
for referenced objects. As long as an object has a reference to any
other object it doesn't get removed. The problem could be solved if
the carbage collector whould follow to the DB root for each object.
My guess is that the carbage collector doesn't look for such root
references. (could be very slow)

If my guess is correct, the following happens.

Since we have annotations and nothing will cleanup the annotation
and it's referenced objects, this objects will stay forever.
e.g. security map, dublin core

And it also means:
In your custom project, you have to take care on every reference.
This means you have to set every object reference and back reference
to None if you remove objects.

Are I'm right or totaly wrong?

Roger Ineichen

More information about the Zope3-users mailing list