jmap 查看 jvm 中 heap 堆 和 非堆 内存大小
使用方法: jmap -heap PID
[root@instance-2gak1pfv debuginfo]# java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode) [root@instance-2gak1pfv debuginfo]# jps -l 1421 org.apache.zookeeper.server.quorum.QuorumPeerMain 40565 sun.tools.jps.Jps [root@izuf6ea4rfo45y44oj74jhz logs]# jmap -heap 1421 Attaching to process ID 1421, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.191-b12 using thread-local object allocation. Mark Sweep Compact GC Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 482344960 (460.0MB) NewSize = 10485760 (10.0MB) MaxNewSize = 160759808 (153.3125MB) 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: New Generation (Eden + 1 Survivor Space): capacity = 48758784 (46.5MB) used = 42933176 (40.94426727294922MB) free = 5825608 (5.555732727050781MB) 88.05218768376176% used Eden Space: capacity = 43384832 (41.375MB) used = 42933176 (40.94426727294922MB) free = 451656 (0.43073272705078125MB) 98.95895413401624% used From Space: capacity = 5373952 (5.125MB) used = 0 (0.0MB) free = 5373952 (5.125MB) 0.0% used To Space: capacity = 5373952 (5.125MB) used = 0 (0.0MB) free = 5373952 (5.125MB) 0.0% used tenured generation: capacity = 108146688 (103.13671875MB) used = 64887344 (61.88139343261719MB) free = 43259344 (41.25532531738281MB) 59.99938158069159% used 21962 interned Strings occupying 2552376 bytes.
可能错误
jmap错误:unknown CollectedHeap type : class sun.jvm.hotspot.gc_interface.CollectedHeap
[root@instance-2gak1pfv debuginfo]# jmap -heap 110386 Attaching to process ID 110386, please wait... Debugger attached successfully. Server compiler detected. JVM version is 25.191-b12 using thread-local object allocation. Mark Sweep Compact GC Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 255852544 (244.0MB) NewSize = 5570560 (5.3125MB) MaxNewSize = 85262336 (81.3125MB) OldSize = 11206656 (10.6875MB) 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
解决方法:
去网站 http://debuginfo.centos.org/7/x86_64 里面找匹配当前的 openjdk 的版本,小版本号也要匹配上。然后使用wget命令下载
wget http://debuginfo.centos.org/7/x86_64/java-1.8.0-openjdk-debuginfo-1.8.0.191.b12-1.el7_6.x86_64.rpm
使用rpm命令安装
rpm -ivh java-1.8.0-openjdk-debuginfo-1.8.0.191.b12-1.el7_6.x86_64.rpm
然后查看是否安装了debuginfo
[root@izuf6ea4rfo45y44oj74jhz logs]# rpm -qa|grep debuginfo java-1.8.0-openjdk-debuginfo-1.8.0.191.b12-1.el7_6.x86_64
0顶
0 踩
共 0 条评论