B
Bill O
Is there a way to determine the number of references to an object? I only
need a reference count.
Thank you,
Bill
need a reference count.
Thank you,
Bill
Bill said:Is there a way to determine the number of references to an object? I only
need a reference count.
Bill O said:Is there a way to determine the number of references to an object? I only
need a reference count.
Thank you,
Bill
Bill O said:Is there a way to determine the number of references to an object? I only
need a reference count.
Chris Dunaway said:A simple way would be to add a static counter variable to the class and
in the constructor increment the counter. Each successive creation of
and instance of the class will increment the counter.
The garbage collector uses some way of determining when an object
instance's reference count reaches zero, because that's what makes the
object instance a candidate for collection.
counting,
but walks the root graph looking for reachable objects.
Bill O said:This is for our enterprise, data mapping framework. We have an object cache
(identity map) where each object in the application domain is associated
with a distinct database row (domain object). One of our constraints is that
we have to expire domain objects that have been in memory a long time but
are no longer referenced by our other calling frameworks.
Bill O said:This is for our enterprise, data mapping framework. We have an object cache
(identity map) where each object in the application domain is associated
with a distinct database row (domain object). One of our constraints is that
we have to expire domain objects that have been in memory a long time but
are no longer referenced by our other calling frameworks.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.