Do array class name symbols for unloaded array classes leak deliberately?
Thomas Stüfe
thomas.stuefe at gmail.com
Mon Jan 21 15:29:09 UTC 2019
Hi all,
Looking at ~ClassLoaderData(), I see that we never seem to decrease the
refcount on Klass::_name for ArrayKlass* childs. We do this for
InstanceKlass* childs (via ReleaseKlassClosure::do_klass() ->
InstanceKlass::release_C_heap_structures(k)) but not for ArrayKlass*.
This causes observable leaks: When I run a small test program where I load
a number of generated classes, instance and array both, and then GC them,
the array class symbol names leak:
thomas at t450:/shared/projects/openjdk/jdk-jdk/output-fastdebug$ jjjcmd
test3.Example2 VM.symboltable -verbose | grep myclass
26 65535: [Lmyclass_size_1_number_0;
26 65535: [Lmyclass_size_1_number_1;
26 65535: [Lmyclass_size_1_number_2;
This seems to be always have been the case and it seems deliberate: the
array class name is created as a permanent symbol :
Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data,
int n, Klass*
element_klass, TRAPS) {
...
name = SymbolTable::new_permanent_symbol(new_str, CHECK_0);
...
}
Why is that? Why do we remove class name symbols for instance classes, but
leave them for arrays?
Thanks & Kind Regards, Thomas
More information about the hotspot-runtime-dev
mailing list