FW: PhantomReference: why not cleared by GC when enqueued?

Dmytro Sheyko dmytro_sheyko at hotmail.com
Thu May 30 11:32:08 UTC 2013


Mark,

You are listed as an author of java.lang.ref classes. So you must know more than others. Could you shed light on this?

Thank you,
Dmytro

From: dmytro_sheyko at hotmail.com
To: hotspot-gc-dev at openjdk.java.net; core-libs-dev at openjdk.java.net
Subject: PhantomReference: why not cleared by GC when enqueued?
Date: Wed, 29 May 2013 14:45:54 +0300




Hello,

Why phantom references are not automatically cleared by the garbage collector as they are enqueued?

Keeping phantom reachable objects in heap has some drawbacks:
1. At least 2 GC are required in order to reclaim them, even in case when application code pulls references from reference queue and clears them promptly.
2. GC pauses are increased since phantom reachable objects are still to be marked.

On the other hand, benefits are not obvious. How we can use referent if it's not accessible?

Regards,
Dmytro

 		 	   		   		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20130530/cc736583/attachment.htm>


More information about the hotspot-gc-dev mailing list