[ZODB-Dev] Getting refcount of object in ZODB

Barry A. Warsaw barry@digicool.com
Thu, 28 Jun 2001 14:13:43 -0400


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

    GW> Is there a way to get the refcount of an object in a ZODB?  I
    GW> seem to recall reading that ZODB does some sort of garbage
    GW> collection, so presumably it tracks reference counts.  (I'm
    GW> curious to see if the reality of our database matches our
    GW> expectation.)

There's no advertised storage API way of getting this information
AFAIK.  Different storages will maintain that information in different
ways (e.g. in Berkeley Full, it's maintained in a separate table --
well, two tables really, one for objects and the other for pickles ;).

I don't know about other storages, but it should be trivial to write
an extension to Full that, giving an oid, returns the refcount for
that object.

-Barry