RFR: 8071507: (ref) Clear phantom reference as soft and weak references do

Kim Barrett kim.barrett at oracle.com
Fri Dec 18 20:20:05 UTC 2015

On Dec 18, 2015, at 12:46 AM, Tao Mao <yiyeguhu at gmail.com> wrote:
> On Thu, Dec 17, 2015 at 9:34 PM, Mandy Chung <mandy.chung at oracle.com> wrote:
> > On Dec 17, 2015, at 6:05 PM, Tao Mao <yiyeguhu at gmail.com> wrote:
> > On line 38, can we also add "through a chain of strong, soft, and weak references." to the above, which I think is the case?
> >
> Yes it is and this is not strictly needed. For phantom reference case, this can be left “unqualified” as it’s basically a chain of any reference type.
> Strictly speaking, any reference type but phantom reference. 

This wording (for weak references, with similar wording for others):

  At that time it will atomically clear all weak references to that
  object and all weak references to any other weakly-reachable objects
  from which that object is reachable through a chain of strong and
  soft references.

exists to require that an implementation ensures that, after a
reference has been cleared, it is no longer possible for an
application to recover the former referent of that reference via a
sequence of references of the same or greater strength as that

It can be shown by induction that the same reference type as that
being cleared doesn't need to be mentioned in order to achieve that

Adding the cleared reference type to the chain list might impose a
stronger requirement on implementations.  However, we don't think an
implementation can usefully take advantage of any difference, so in
the case of phantom references we opted for shorter wording.

More information about the hotspot-gc-dev mailing list