ClassValue rooting objects after it goes away?

Jochen Theodorou blackdrag at gmx.org
Wed Aug 26 20:40:53 UTC 2015


Am 07.08.2015 13:04, schrieb Michael Haupt:
> Hi Charles,
>
> the pull request mentions a class named Java7ClassValue - does this mean
> it's a Java 7 issue or is it reproducible on 8 and maybe even 9? Names
> can be misleading. ;-)
>
> To clarify: by what means is the ClassValue removed in the JRuby
> implementation?
>
> I agree this should not happen.

coming back on this and after spending the whole day on debugging a 
permgen issue (and Cedric actually 3 days) that seems to be related to this.

I am not from the Ruby guess, so I will show the Groovy part. We 
discovered a permgen issue, that prevents the groovy runtime from 
unloading and the reason turned out to be ClassValue. We get a similar 
graphic Charles got, only a bit more complex. In my test scenario we 
load the Groovy runtime in an URLClassLoader, call a method to cause the 
runtime to initialize and then forget about it, just to do this again in 
a loop. What happens is that we get into a permgen problem, since the 
loader cannot be unloaded because ClassValue seems to keep classes from 
that loader to unload.

I tested this with 7_60, 7_65, 8_25, and jdk1.9.0-ea-b68. All have this 
problem.

As a special bonus we have a lot of system classes with added class 
values... for example all the primitive types. I suspected ClassValue 
earlier already and made myself a simple test but it seems the simple 
version is not going to show me what I want. So it is not as simple as 
having a classloader load a custom ClassValue class and have the 
classloader not unloading.

Guess we will try the WeakReference vesion next as well... not that is a 
solution for us.

bye blackdrag

-- 
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/



More information about the mlvm-dev mailing list