Howto keep track of GC, without letting the monitored object die?
Clemens Eisserer
linuxhippy at gmail.com
Wed Mar 25 16:28:27 UTC 2009
Hi Tony,
> You can use WeakReferences. Have a look at this article:
>
> http://java.sun.com/developer/technicalArticles/javase/finalization/
>
> 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.
Thanks, Clemens
More information about the hotspot-gc-dev
mailing list