[ZODB-Dev] __del__ with Persistent objects

Toby Dickenson tdickenson at geminidataloggers.com
Thu Jul 17 17:42:59 EDT 2003


On Thursday 17 July 2003 16:33, Stuart Bishop wrote:

> I've run tests with an object acting
> as a factory to generate these FileRefs, which keeps a
> reference to the generated object. It can then look over
> this list, doing a sys.getrefcount(ob) on each and doing the
> cleanup if it is the last instance. This appears to work, but
> I'd be interested in knowing how reliable this method would be.

It is terribly unreliable. that counts the number of links in the current 
python interpreter, which has no relation to an object being accessible in 
the storage.

Do the filesystem-based things know the oid or path of the thing that created 
them? if yes, you could create some external garbage collection process.

> I'd rather not have to
> write and maintain manage_beforeDelete hooks that trawl through
> the soon-to-be-deleted object's data structures for these objects
> if I can avoid it :-)

That approach is annoying, but viable.

There is an alternative approach that Im sure you have considered.... store 
these things direct in the ZODB, and forget the filesystem.

-- 
Toby Dickenson - http://www.geminidataloggers.com/people/tdickenson

Would you like my job? http://www.geminidataloggers.com/jobs for Software
Engineering jobs at Gemini Data Loggers in Chichester, West Sussex, England




More information about the ZODB-Dev mailing list