On 17.05.16 09:48, Alain Stalder wrote:
Experimentally, for the test with ClassGCTester, the first call
(metaRegistry.removeMetaClass(clazz)) was not necessary to have
garbage collection before Metaspace reaches the maximum, the other two
were.
Makes sense:
metaRegistry keeps no reference to the class, instead it gets ClassInfo
and stores the MetaClass there.
Introspector has a reference to the class: It contains a WeakHashMap
(resp. a class derived of it) with the class as the key and an array of
java.lang.reflect.Method as the value, which, in turn, has the class
reference in a private field.
Alain