-
Enhancement
-
Resolution: Fixed
-
P3
-
14
-
b15
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8271947 | 11.0.14-oracle | Harold Seigel | P3 | Resolved | Fixed | b01 |
JDK-8271823 | 11.0.13 | Jiangli Zhou | P3 | Resolved | Fixed | b02 |
Similar to JDK-8214756 -- when the JVM creates an hprof dump, it should exclude CDS archived objects whose class is not yet loaded. Otherwise the dumped hprof file would fail to load in heap analysis tools, such as Eclipse Memory Analyzer (MAT).
public class HelloGC {
public static void main(String ... args) throws Exception {
if (args.length > 0) {
loadArray("java.lang.Byte");
loadArray("java.lang.Character");
loadArray("java.lang.Integer");
loadArray("java.lang.Long");
loadArray("java.lang.Short");
loadArray("java.util.HashMap$Node");
loadArray("jdk.internal.math.FDBigInteger");
loadArray("sun.util.locale.BaseLocale");
}
System.gc();
}
static void loadArray(String className) throws Exception {
Class c = Class.forName(className);
Object array = java.lang.reflect.Array.newInstance(c, 0);
System.out.println(array);
}
}
The following produces an hprof file that fails to load in Eclipse MAT with
"Error: Found instance segment but expected class segment (see FAQ): 0x0". See java_pid8323.hprof in attachment.
$ java -XX:+HeapDumpAfterFullGC HelloGC
The problem can be worked around by explicitly loading the required classes before doing the heap dump. See java_pid32027.hprof in attachment.
$ java -XX:+HeapDumpAfterFullGC HelloGC fixit
public class HelloGC {
public static void main(String ... args) throws Exception {
if (args.length > 0) {
loadArray("java.lang.Byte");
loadArray("java.lang.Character");
loadArray("java.lang.Integer");
loadArray("java.lang.Long");
loadArray("java.lang.Short");
loadArray("java.util.HashMap$Node");
loadArray("jdk.internal.math.FDBigInteger");
loadArray("sun.util.locale.BaseLocale");
}
System.gc();
}
static void loadArray(String className) throws Exception {
Class c = Class.forName(className);
Object array = java.lang.reflect.Array.newInstance(c, 0);
System.out.println(array);
}
}
The following produces an hprof file that fails to load in Eclipse MAT with
"Error: Found instance segment but expected class segment (see FAQ): 0x0". See java_pid8323.hprof in attachment.
$ java -XX:+HeapDumpAfterFullGC HelloGC
The problem can be worked around by explicitly loading the required classes before doing the heap dump. See java_pid32027.hprof in attachment.
$ java -XX:+HeapDumpAfterFullGC HelloGC fixit
- backported by
-
JDK-8271823 Heap dumps should exclude dormant CDS archived objects of unloaded classes
- Resolved
-
JDK-8271947 Heap dumps should exclude dormant CDS archived objects of unloaded classes
- Resolved
- relates to
-
JDK-8320924 Improve heap dump performance by optimizing archived object checks
- Resolved
-
JDK-8214756 SA should ignore archived java heap objects that are not in use
- Resolved
(1 links to)