Do array class name symbols for unloaded array classes leak deliberately?
Thomas Stüfe
thomas.stuefe at gmail.com
Tue Jan 22 17:04:58 UTC 2019
Thank you Coleen. I'll open an issue and if time permits post a fix with it.
..Thomas
On Tue, Jan 22, 2019 at 5:07 PM <coleen.phillimore at oracle.com> wrote:
>
> Hi Thomas, Yes, this appears to be a bug. It looks intentional but I
> can't remember why it would be, and didn't leave a comment.
>
> Can you file a bug with your test case?
>
> thanks,
> Coleen
>
> On 1/21/19 10:29 AM, Thomas Stüfe wrote:
> > 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