Use jmap -heap detailed information being given command to view the heap
Caused by: java.lang.RuntimeException: unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap
[root@bangbet-java ~]# jmap -heap 27822 Attaching to process ID 27822, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.222-b10 using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration: MinHeapFreeRatio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 1073741824 (1024.0MB) NewSize = 536870912 (512.0MB) MaxNewSize = 536870912 (512.0MB) OldSize = 536870912 (512.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:157) 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:50) ... 6 more
Strange, is not a local problem, but this happens on linux
View the next jdk version is 1.8, it lacks the problem
Local is HotSpot
Online is OpenJDK
Ultimate cause
Here -heap option calls use the debug package under sun.jvm, and the default installation does not include openJDK!
Solutions
Download and install a java-openjdk-debug plug-ins! And the need and the small version openjdk is also consistent! ! !
Installation debuginfo
Go to the website http://debuginfo.centos.org/7/x86_64 inside to find the matching version of the current openjdk, small version number should match on.
Then use wget command to download
wget http://debuginfo.centos.org/7/x86_64/java-1.8.0-openjdk-debuginfo-1.8.0.222.b10-0.el7_6.x86_64.rpm
Use the rpm command to install
rpm -ivh java-1.8.0-openjdk-debuginfo-1.8.0.222.b10-0.el7_6.x86_64.rpm
Check whether the installation debuginfo
[root@bangbet-java ~]# rpm -qa|grep debuginfo java-1.8.0-openjdk-debuginfo-1.8.0.222.b10-0.el7_6.x86_64
Query again
[root@bangbet-java ~]# jmap -heap 27968 Attaching to process ID 27968, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.222-b10 using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration: MinHeapFreeRatio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 2147483648 (2048.0MB) NewSize = 1073741824 (1024.0MB) MaxNewSize = 1073741824 (1024.0MB) OldSize = 1073741824 (1024.0MB) NewRatio = 2 SurvivorRatio = 8 MetaspaceSize = 21807104 (20.796875MB) CompressedClassSpaceSize = 1073741824 (1024.0MB) MaxMetaspaceSize = 17592186044415 MB G1HeapRegionSize = 0 (0.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 1054867456 (1006.0MB) used = 521443544 (497.28731536865234MB) free = 533423912 (508.71268463134766MB) 49.43213870463741% used From Space: capacity = 8388608 (8.0MB) used = 8377312 (7.989227294921875MB) free = 11296 (0.010772705078125MB) 99.86534118652344% used To Space: capacity = 9437184 (9.0MB) used = 0 (0.0MB) free = 9437184 (9.0MB) 0.0% used PS Old Generation capacity = 1073741824 (1024.0MB) used = 334280072 (318.79431915283203MB) free = 739461752 (705.205680847168MB) 31.132257729768753% used 35880 interned Strings occupying 4018400 bytes.
ok, solved finished!
Problems encountered version
My jdk version is 1.8.0_222-b10, in http://debuginfo.centos.org/7/x86_64 find two
First download the most recent discovery is not so that, after uninstalling another re-download
rpm uninstall
rpm -e --nodeps java-1.8.0-openjdk-debuginfo-1:1.8.0.222.b10-1.el7_7.x86_64
After re-install it