RFR: 8256167: Convert JDK use of `Reference::get` to `Reference::refersTo`

Daniel Fuchs dfuchs at openjdk.java.net
Fri Dec 4 10:41:12 UTC 2020


On Thu, 3 Dec 2020 22:54:54 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> This patch replaces some uses of `Reference::get` to `Reference::refersTo` to avoid keeping a referent strongly reachable that could cause unnecessary delay in collecting such object.   I only made change in some but not all classes in core libraries when working with Kim on `Reference::refersTo`.    The remaining uses are left for the component owners to convert at appropriate time.

Hi Mandy,

This looks good to me. There are a few places where a single call to `Reference::get` is replaced by multiple calls to `Reference::refersTo`, allowing the reference to get cleared in between, but as far as I could see that doesn't affect the overall logic which is still sound.
So LGTM!

best regards,
-- daniel

-------------

Marked as reviewed by dfuchs (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1609


More information about the serviceability-dev mailing list