Details
-
Task
-
Status: Closed
-
Minor
-
Resolution: Later
-
None
-
None
Description
To understand when the JVM purges our WeakReferences from memory we can add some debug logging that will print out when the References are collected by the GC: http://java.sun.com/javase/6/docs/api/java/lang/ref/ReferenceQueue.html
By providing a ReferenceQueue when we create a Reference then the GC will add the Reference to the Queue when it collects the referent.
We can then monitor the queue with a new thread on the blocking queue.remove() call.