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

                                          

Reply via email to