Questions about negative loaded classes ...

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Oct 3 12:10:17 UTC 2017


> 1. On more than half of the machines (200 out of 400 machines), we see he
> JMX counter report negative LoadedClassCount, see attached jmxcounter.png.
> 
> After some further dig, we note UnloadedClassCount is larger than
> TotalLoadedClassCount. And  LoadedClassCount (-695,710) =
> TotalLoadedClassCount - UnloadedClassCount . PerfCounter reports the same
> number, here is the result on the same machine:
> 
>      $ jcmd 307 PerfCounter.print | grep -i class | grep -i java.cls
>      java.cls.loadedClasses=192004392
>      java.cls.sharedLoadedClasses=0
>      java.cls.sharedUnloadedClasses=0
>      java.cls.unloadedClasses=192700102

JVM performance counters aren't exact (e.g., updates aren't atomic [1]), 
so I wouldn't be surprised to see loadedClasses & unloadedClasses 
diverging during concurrent class loading.

Best regards,
Vladimir Ivanov

[1] 
http://hg.openjdk.java.net/jdk8u/jdk8u-dev/hotspot/file/92693f9dd704/src/share/vm/runtime/perfData.hpp#l425


More information about the hotspot-dev mailing list