Resolve "unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap"

Home > Search
  by

This error appears when attempt to analyze a JVMs heap using the jmap utility.

[root@server1 ~]# jmap -heap <PID>
Attaching to process ID 12345, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.144-b01

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
   MinHeapFreeRatio         = 40
   MaxHeapFreeRatio         = 70
   MaxHeapSize              = 536870912 (512.0MB)
   NewSize                  = 10485760 (10.0MB)
   MaxNewSize               = 178913280 (170.625MB)
   OldSize                  = 20971520 (20.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)

Heap Usage:
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.tools.jmap.JMap.runTool(JMap.java:201)
        at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: java.lang.RuntimeException: unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap
        at sun.jvm.hotspot.tools.HeapSummary.run(HeapSummary.java:144)
        at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:49)
        ... 6 more

 

Creating a dump is a workaround for this issue.

~]# jmap -dump:format=b,file=/tmp/testDump <PID>
Dumping heap to /tmp/testDump ...
Heap dump file created

 

Then, analyze the dump using jhat. This will open a port on the server (7000) in this example. You can then navigate to www.example.com:7000 to view the jhat analysis of the dump.

~]# jhat testDump
Reading from testDump...
Dump file created Sun Oct 22 00:40:01 CDT 2017
Snapshot read, resolving...
Resolving 290870 objects...
Chasing references, expect 58 dots..........................................................
Eliminating duplicate references..........................................................
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.

 

For example, let's say you are looking into an issue with the objects in a class named myServlet.

public class myServlet {
    example example;
}

 

The heap dump should have captured the class named myServlet, and the jhat analysis should also show that the class myServlet was captured.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments