RFR: 6543126: Level.known can leak memory

Chris Hegarty chris.hegarty at oracle.com
Wed Jul 27 10:17:23 UTC 2016


Hi Daniel,

On 25/07/16 19:10, Daniel Fuchs wrote:
> Hi,
>
> Please find below a fix for:
>
> 6543126: Level.known can leak memory
> https://bugs.openjdk.java.net/browse/JDK-6543126
>
> webrev:
> http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.00

Since mirroredLevel is a strong reference to the same given Level,
in the case where the level's class is the JDK's Level.class, then
you do not need either of the reachabilityFence's.

With this change there is a race between checking the weak reference
and accessing the mirroredLevel, this is evident in findLevel(String).
I think this is benign, the code is racy, but not susceptible to any
issues resulting from this.

Otherwise, the changes look good to me.

-Chris


More information about the core-libs-dev mailing list