RFR (S): 8011803: release_C_heap_structures is never called for anonymous classes.

David Holmes david.holmes at oracle.com
Fri Apr 12 04:58:13 PDT 2013


Thanks Coleen. I mentally treat ClassLoaderData as a ClassLoader but 
that's not right.

David

On 12/04/2013 9:54 PM, Coleen Phillimore wrote:
> On 4/11/2013 10:21 PM, David Holmes wrote:
>> Hi Coleen,
>>
>> Can you clarify something for me please. ClassLoaderData::unload() is
>> what now cleans up the anonymous classes - correct? But
>> ClassLoaderData::unload() is only called when the ClassLoader is
>> unloaded - correct? And the whole point of anonymous classes is that
>> they get unloaded independent of the classloader lifecycle. Assuming
>> I'm correct so far it seems to me that if the classloader is never
>> unloaded, the anonymous classes still won't have
>> release_C_heap_structures called. And if it is unloaded it could be
>> well after the classes were unloaded.
>
> Hi David,
>
> Yes, anonymous classes do get unloaded independent of the class loader
> lifecycle, but they get their own ClassLoaderData when created.   This
> ClassLoaderData is tied to the lifetime of the anonymous class's mirror,
> so when the mirror is unreferenced, the CLD will get unloaded.    With
> anonymous classes there is not a 1-1 relationship between object of
> java/lang/ClassLoader and CLD.
>
> I did it this way because otherwise the metadata for the anonymous
> classes is never reclaimed (or reclamation would have to walk the CLD
> graph and put holes in the metaspaces).
>
> Thanks,
> Coleen
>
>
>>
>> David
>>
>> On 12/04/2013 6:52 AM, Coleen Phillimore wrote:
>>> Summary: Call this function from CLD::unload()  now for anonymous
>>> classes.
>>>
>>> Anonymous classes aren't in the system dictionary so
>>> release_C_heap_structures isn't called for them if they are unloaded.  I
>>> fixed this for jdk8 because they are in the class loader data graph but
>>> for jdk7, I don't know how to fix this.  They are unloaded by being
>>> garbage collected after the references are dropped.
>>>
>>> Tested with ute tests vm.mvlm.testlist nsk.monitoring.testlist and
>>> jdk/test/java/lang/invoke tests.
>>>
>>> open webrev at http://cr.openjdk.java.net/~coleenp/8011803/
>>> bug link at http://bugs.sun.com/view_bug.do?bug_id=8011803
>>>
>>> Thanks,
>>> Coleen
>


More information about the hotspot-dev mailing list