A reproducer for the JDK-8245951 JFR memory leak. The leak is jdk.jfr.internal.TypeLibrary
keeps on holding to jdk.jfr.internal.PlatformEventType
instances even when the underlying classes are unloaded.
This can for example happen when you redeploy a web application that contains custom JFR events.
The dominator tree shows the issue is jdk.jfr.internal.TypeLibrary
.
The histogram shows the issue is jdk.jfr.internal.TypeLibrary
holding on to jdk.jfr.internal.PlatformEventType
.
The object list shows the issue is jdk.jfr.internal.TypeLibrary#types
holding on to jdk.jfr.internal.PlatformEventType
.
The classloader explorer shows not ClassLoader-leaks.
The issue can be reproduced with
java -Xmx64m -Xms64m -XX:MaxMetaspaceSize=64m -XX:+UseSerialGC -XX:+HeapDumpOnOutOfMemoryError -jar target/jfr-leaker-0.1.0-SNAPSHOT.jar