运行命令:
jmap -heap 6709
报错如下:
Attaching to process ID 6709, please wait... sun.jvm.hotspot.debugger.NoSuchSymbolException: Could not find symbol "gHotSpotVMTypes" in any of the known library names (libjvm.so, libjvm_g.so, gamma_g) at sun.jvm.hotspot.HotSpotTypeDataBase.lookupInProcess(HotSpotTypeDataBase.java:585) at sun.jvm.hotspot.HotSpotTypeDataBase.readVMTypes(HotSpotTypeDataBase.java:150) at sun.jvm.hotspot.HotSpotTypeDataBase.<init>(HotSpotTypeDataBase.java:85) at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:569) at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:493) at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:331) at sun.jvm.hotspot.tools.Tool.start(Tool.java:163) at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at sun.tools.jmap.JMap.runTool(JMap.java:197) at sun.tools.jmap.JMap.main(JMap.java:128) Debugger attached successfully. sun.jvm.hotspot.tools.HeapSummary requires a java VM process/core!
报错原因:
根据错误提示,可以看出来,需要一个java jvm的核心进程。
明明PID就是我java进程的PID,进程编号呀。
错误原因:
PID不是你要查看的JAVA进程的PID,注意区分你到底要查看那个JVM进程。
解决方法:
查看java进程的PID
ps -ef | grep java
现在自己查看一下,就可以发现
6709是另一个位置的java进程。
19570才是 我们当前想要查看的JVM进程。
因为自己安装的java路径在/mnt/apps/soft/java路径 。配置的环境变量也是这个路径下的JDK.
所以运行jmap指定错误的PID就导致了开始的错误。
现在修改jmap指定的PID
jmap -heap 19570
运行成功:
Attaching to process ID 19570, please wait... Debugger attached successfully. Server compiler detected. JVM version is 24.80-b11 using thread-local object allocation. Parallel GC with 8 thread(s) Heap Configuration: MinHeapFreeRatio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 4164943872 (3972.0MB) NewSize = 1310720 (1.25MB) MaxNewSize = 17592186044415 MB OldSize = 5439488 (5.1875MB) NewRatio = 2 SurvivorRatio = 8 PermSize = 21757952 (20.75MB) MaxPermSize = 85983232 (82.0MB) G1HeapRegionSize = 0 (0.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 1245708288 (1188.0MB) used = 550338952 (524.844123840332MB) free = 695369336 (663.155876159668MB) 44.17879830305825% used From Space: capacity = 68681728 (65.5MB) used = 507920 (0.4843902587890625MB) free = 68173808 (65.01560974121094MB) 0.7395271126550572% used To Space: capacity = 70254592 (67.0MB) used = 0 (0.0MB) free = 70254592 (67.0MB) 0.0% used PS Old Generation capacity = 217055232 (207.0MB) used = 116954920 (111.53690338134766MB) free = 100100312 (95.46309661865234MB) 53.88256201997471% used PS Perm Generation capacity = 85983232 (82.0MB) used = 75303848 (71.81534576416016MB) free = 10679384 (10.184654235839844MB) 87.57968995629287% used 40959 interned Strings occupying 4521736 bytes.
原文地址:https://www.cnblogs.com/sxdcgaq8080/p/11089179.html
时间: 2024-10-14 13:29:42