RFR: 6543126: Level.known can leak memory

Daniel Fuchs daniel.fuchs at oracle.com
Tue Sep 13 12:45:05 UTC 2016


Hi Mandy,

Here is a new webrev with your feedback integrated.

Finally I managed to get rid of the InternalError in MethodHandle
by using:
            PrivilegedAction<ClassLoader> pa = () ->
                  customLevel.getClass().getClassLoader();

instead of
            PrivilegedAction<ClassLoader> pa =
                  customLevel.getClass()::getClassLoader;

Not quite sure what was the issue. I can't manage to reproduce
it in a stand alone test :-(

Anyway - the new webrev no longer has the KnownLevelCLV class:

http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.05

best regards,

-- daniel

On 29/08/16 21:10, Mandy Chung wrote:
>
>> On Aug 29, 2016, at 6:10 AM, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
>>
>> Here is a new webrev that uses ClassLoaderValue as Peter suggested.
>>
>> http://cr.openjdk.java.net/~dfuchs/webrev_6543126/webrev.04/
>>
>
> Looks good in general.
>
>  553         // KnowLevelCLV is used to register custom level instances with
>
> typo: s/KnowLevelCLV/KnownLevelCLV
>
>  568             final Level level;
>
> Nit: perhaps renaming level to customLevel to make it clear what this is.
>
> line 645, 646: s/gced/GC’ed/
>
>
>> I had to introduce a new private static class (KnownLevelCLV)
>> to avoid using lambdas in KnownLevel.add - as CustomLevel.java
>> was failing with an InternalError raised in MethodHandles$Lookup
>> otherwise.
>
> I agree it’s good to make progress on JDK-6543126.  I think it’d be good to understand how we get to this InternalError during bindCaller.  Can you file a low priority JBS issue to track that?
>
> Mandy
>



More information about the core-libs-dev mailing list