Jack > ~ > jmap -heap 68202 Attaching to process ID 68202, please wait... ERROR: attach: task_for_pid(68202) failed: '(os/kern) failure' (5) Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges. sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process. Could be caused by an incorrect pid or lack of privileges.
PS C:\Users\jack> jhsdb jmap --heap --pid 10648 Attaching to process ID 10648, please wait... Debugger attached successfully. Server compiler detected. JVM version is 11.0.6+8-LTS
using thread-local object allocation. Garbage-First (G1) GC with 4 thread(s)
Heap Usage: G1 Heap: regions = 2020 capacity = 2118123520 (2020.0MB) used = 1048576 (1.0MB) free = 2117074944 (2019.0MB) 0.04950495049504951% used G1 Young Generation: Eden Space: regions = 1 capacity = 15728640 (15.0MB) used = 1048576 (1.0MB) free = 14680064 (14.0MB) 6.666666666666667% used Survivor Space: regions = 0 capacity = 0 (0.0MB) used = 0 (0.0MB) free = 0 (0.0MB) 0.0% used G1 Old Generation: regions = 0 capacity = 118489088 (113.0MB) used = 0 (0.0MB) free = 118489088 (113.0MB) 0.0% used
使用 histo 参数查看对象大小
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
PS C:\Users\jack> jhsdb jmap --histo --pid 10648 Attaching to process ID 10648, please wait... Debugger attached successfully. Server compiler detected. JVM version is 11.0.6+8-LTS Iterating over heap. This may take a while... Object Histogram: