RFR: 6543126: Level.known can leak memory
Daniel Fuchs
daniel.fuchs at oracle.com
Wed Jul 27 12:58:51 UTC 2016
Hi Chris,
On 27/07/16 11:17, Chris Hegarty wrote:
> 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.
Yes good catch.
> 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.
Yes - nothing would prevent the custom level Object (the
reference's target) to be garbaged collected just after the
mirrored level is returned, but we don't care.
So there would be no point in trying to ensure the reference is
not stale just before returning. That's acceptable.
>
> Otherwise, the changes look good to me.
Thanks!
>
> -Chris
More information about the core-libs-dev
mailing list