[ZODB-Dev] Getting refcount of object in ZODB

Barry A. Warsaw barry@digicool.com
Thu, 28 Jun 2001 15:23:25 -0400


>>>>> "GW" == Greg Ward <gward@mems-exchange.org> writes:

    GW> So is GC entirely the storage's responsibility, then?

Yes (at least that's my belief, Jim may have a different, overriding
opinion. ;).

Note that just as in Python itself, a storage may have both reference
counting gc, and cyclic gc.  Berkeley's Full is an example of this; it
has reference counting gc, and an interface to a separate
storage-independent cyclic collector, but it currently hasn't been
hooked up to the cycle detector, so it doesn't collect cycles.
(That's been put off the table for Berkeley storage's 1.0 final
release.)
    
    GW> I.e., should I be poking about in FileStorage.py looking for
    GW> rude back-door ways of getting the refcount?

Probably.

    GW> Or should I just say: Jim, given DB/Connection/FileStorage
    GW> objects and either an OID or database object, how do I get the
    GW> refcount for the object?  And is that info available for
    GW> ClientStorage as well?  Or will I have to shutdown my ZEO
    GW> server and access the database as a FileStorage to find this
    GW> out?

Probably.

    GW> No, I do *not* intend to use this in an application, it's
    GW> mainly curiosity.  I want to make sure that an object I think
    GW> is about to drop to zero refs really does drop to zero refs.

As a debugging tool, then, it probably does make some sense.  I
believe there are some tests for this in the unittests that come with
Berkeley and/or StandaloneZODB.  They may not be terribly robust
though (I mean the tests more than the storages ;).

-Barry