Howto keep track of GC, without letting the monitored object die?
linuxhippy at gmail.com
Wed Mar 25 16:28:27 UTC 2009
> You can use WeakReferences. Have a look at this article:
> In particular, the An Alternative To Finalization section.
I don't see how. In my example I rely on the behaviour that I can add
a strong reference to the SharedObject when the finalizer runs,
therefor letting it survive the GC.
As far as I understand, with WeakReferences I could get a notification
that the object was reclaimed but once I get the notification, the
SharedObject as well as the monitorObject would both be gone already.
More information about the hotspot-gc-dev