[Zope] ZODB drops _v_ attributes.

Toby Dickenson tdickenson@geminidataloggers.com
Tue, 8 Apr 2003 15:51:38 +0100


On Tuesday 08 April 2003 2:03 pm, Etienne Labuschagne wrote:
> Just a question in general on this subject:
>
> When I retrieve an object out of a ZODB and that object instantiates some
> volatile variables.  How long can I expect that object to hang on to those
> volatile variables?

The cache is flushed at the end of a transaction, and can be flushed manually. 
At that time it currently uses a strict least-recently-used eviction policy, 
but that is not guaranteed in future.

The volatile attribute is then lost - the same as all of that object's 
attributes. The only difference between volatile and non-volatile is that 
this attribute can not be recreated if the object is subsequently 
reactivated.

> Shouldn't they last at least until I let go of my reference to the object?

It has to keep the object in memory. Your reference has to point somewhere.

If your object is evicted from cache then it loses its attributes and turns 
into a ghost. Doing anything else would mean that one accidental reference, 
or a circular reference, could keep a huge tree of objects in memory 
indefinitely.

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