On Thu, 28 Apr 2022 07:19:34 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Lookup.defineHiddenClass allows class options to be specified, one of which 
>> is "STRONG" to mean that the hidden class can't unloaded if its defining 
>> loader is reachable.
>> 
>> A static reference or a reachability fence should work for this test.
>
> By default hidden classes are non-strong and can be unloaded when no longer 
> referenced, even if their classloader is still reachable. As you want the 
> hidden class to stick around so it can be reported in the stats then either 
> keep a reference (as you have) or else create it as a STRONG hidden class.

I'm ok with the changes but would like to see the comment fixed. It looks like 
it should be:

"Create a hidden non-strong class. Keep a reference in case a GC happens."

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

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

Reply via email to