GeekIBLi

JVM-jmap

2021-07-28

jmap

命令jmap是一个多功能的命令。它可以生成 java 程序的 dump 文件, 也可以查看堆内对象示例的统计信息、查看 ClassLoader 的信息以及 finalizer 队列。

jmap -heap pid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Attaching to process ID 7183, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.242-b08

using thread-local object allocation.
Parallel GC with 4 thread(s)

Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 2051014656 (1956.0MB)
NewSize = 42991616 (41.0MB)
MaxNewSize = 683671552 (652.0MB)
OldSize = 87031808 (83.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 = 233308160 (222.5MB)
used = 161611280 (154.12452697753906MB)
free = 71696880 (68.37547302246094MB)
69.26945032698384% used
From Space:
capacity = 1572864 (1.5MB)
used = 899896 (0.8582077026367188MB)
free = 672968 (0.6417922973632812MB)
57.213846842447914% used
To Space:
capacity = 1572864 (1.5MB)
used = 0 (0.0MB)
free = 1572864 (1.5MB)
0.0% used
PS Old Generation
capacity = 223346688 (213.0MB)
used = 115841432 (110.4749984741211MB)
free = 107505256 (102.5250015258789MB)
51.866196466723515% used

41772 interned Strings occupying 4324472 bytes.

参考资料

jvm 性能调优工具之 jmap
JVM调试工具-jmap
通过jstack与jmap分析一次线上故障

Tags: JVM