jmap使用
原创转载请注明出处:https://agilestyle.iteye.com/blog/2439738
使用 -heap 查看heap空间概要
jmap -heap 41565 > ~/jmap.txt
Console Output
Attaching to process ID 41565, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.131-b11
using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 1073741824 (1024.0MB)
NewSize = 89456640 (85.3125MB)
MaxNewSize = 348913664 (332.75MB)
OldSize = 178978816 (170.6875MB)
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 = 314048512 (299.5MB)
used = 314048496 (299.49998474121094MB)
free = 16 (1.52587890625E-5MB)
99.99999490524573% used
Eden Space:
capacity = 279183360 (266.25MB)
used = 279183360 (266.25MB)
free = 0 (0.0MB)
100.0% used
From Space:
capacity = 34865152 (33.25MB)
used = 34865136 (33.24998474121094MB)
free = 16 (1.52587890625E-5MB)
99.99995410890507% used
To Space:
capacity = 34865152 (33.25MB)
used = 0 (0.0MB)
free = 34865152 (33.25MB)
0.0% used
concurrent mark-sweep generation:
capacity = 724828160 (691.25MB)
used = 724828160 (691.25MB)
free = 0 (0.0MB)
100.0% used
38460 interned Strings occupying 4469136 bytes.
使用 -histo:live 查看内存中有哪些对象
jmap -histo:live 41565 > ~/jmap.txt

reference
https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jmap.html