jmap作用,获取dump文件,查询finalize执行队列,java堆栈以及类加载器统计。
显示堆栈信息
[@82995c215909 /opt/logs]$ jmap -heap 12527
Attaching to process ID 12527, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
using thread-local object allocation.
Parallel GC with 33 thread(s) //GC 方式
Heap Configuration://堆内存初始化配置
MinHeapFreeRatio = 0 //对应jvm启动参数-XX:MinHeapFreeRatio设置JVM堆最小空闲比率(default 40)
MaxHeapFreeRatio = 100//对应jvm启动参数 -XX:MaxHeapFreeRatio设置JVM堆最大空闲比率(default 70)
MaxHeapSize = 6410993664 (6114.0MB)/对应jvm启动参数-XX:MaxHeapSize=设置JVM堆的最大大小
NewSize = 2306867200 (2200.0MB)//对应jvm启动参数-XX:NewSize=设置JVM堆的‘新生代’的默认大小
MaxNewSize = 2306867200 (2200.0MB)//对应jvm启动参数-XX:MaxNewSize=设置JVM堆的‘新生代’的最大大小
OldSize = 4104126464 (3914.0MB)//对应jvm启动参数-XX:OldSize=:设置JVM堆的‘老生代’的大小
NewRatio = 2//对应jvm启动参数-XX:NewRatio=:‘新生代’和‘老生代’的大小比率
SurvivorRatio = 8//对应jvm启动参数-XX:SurvivorRatio=设置年轻代中Eden区与Survivor区的大小比值
MetaspaceSize = 21807104 (20.796875MB) //对应jvm启动参数-MetaspaceSize=:设置JVM堆的‘元空间’的初始大小; 分配给类元数据空间的初始大小(Oracle逻辑存储上的初始高水位,the initial high-water-mark ). 此值为估计值. MetaspaceSize设置得过大会延长垃圾回收时间. 垃圾回收过后, 引起下一次垃圾回收的类元数据空间的大小可能会变大
CompressedClassSpaceSize = 1073741824 (1024.0MB) //类指针压缩空间大小, 默认为1G
MaxMetaspaceSize = 17592186044415 MB //对应jvm启动参数-MaxMetaspaceSize=:设置JVM堆的‘元空间’的最大;是分配给类元数据空间的最大值, 超过此值就会触发Full GC. 此值仅受限于系统内存的大小, JVM会动态地改变此值
G1HeapRegionSize = 0 (0.0MB) // G1区块的大小, 取值为1M至32M. 其取值是要根据最小Heap大小划分出2048个区块.
Heap Usage:////堆内存使用情况
PS Young Generation
Eden Space:
capacity = 2218786816 (2116.0MB)
used = 1542297984 (1470.8499755859375MB)
free = 676488832 (645.1500244140625MB)
69.51086841143372% used
From Space:
capacity = 44564480 (42.5MB)
used = 5882544 (5.6100311279296875MB)
free = 38681936 (36.88996887207031MB)
13.2000732421875% used
To Space:
capacity = 43515904 (41.5MB)
used = 0 (0.0MB)
free = 43515904 (41.5MB)
0.0% used
PS Old Generation
capacity = 4104126464 (3914.0MB)
used = 55148024 (52.59325408935547MB)
free = 4048978440 (3861.4067459106445MB)
1.3437213615062715% used
27444 interned Strings occupying 3154336 bytes.
显示堆中对象统计信息,包含类,实例数量,合计容量
-histo[:live] to print histogram of java object heap; if the "live"
[@82995c215909 /opt/logs]$ jmap -histo 12527
num #instances #bytes class name
编号 个数 字节 类名
----------------------------------------------
1: 3472120 448670168 [C
2: 2133951 400454032 [B
3: 42628 298218744 [I
4: 2037477 89988696 [Ljava.lang.Object;
5: 3031288 72750912 java.lang.String
6: 1308033 41857056 java.util.HashMap$Node
7: 1673694 34107192 [Ljava.lang.Class;
8: 363209 22618424 [Ljava.util.HashMap$Node;
9: 830984 19943616 java.util.IdentityHashMap$EntryIterator$Entry
10: 181240 14499200 java.lang.reflect.Constructor
11: 422551 13521632 com.alibaba.fastjson.parser.ParseContext
12: 249533 11977584 java.util.HashMap
13: 4039 9598224 [J
14: 178068 8547264 java.util.IdentityHashMap$EntryIterator
15: 134148 7512288 java.util.LinkedHashMap
16: 303126 7275024 java.lang.Long
17: 163622 5235904 java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
18: 12526 4549984 [Lcom.alibaba.fastjson.parser.ParseContext;
19: 141422 4525504 java.util.LinkedHashMap$LinkedKeyIterator
20: 107257 4275968 [Ljava.lang.String;
21: 120468 3854976 java.util.concurrent.ConcurrentHashMap$Node
22: 95655 3826200 java.util.LinkedHashMap$Entry
23: 43136 3795968 java.lang.reflect.Method
24: 78713 3778224 java.nio.HeapByteBuffer
25: 132668 3184032 java.util.ArrayList
类加载器统计
[@82995c215909 /opt/logs]$ jmap -clstats 12527
Attaching to process ID 12527, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 25.101-b13
finding class loader instances ..
done.
computing per loader stat ..done.
please wait.. computing liveness.liveness analysis may be inaccurate …
class_loader classes bytes parent_loader alive? type
类加载器 类的个数 字节数 父类加载器 存活? 类型
2837 4995376 null live
0x0000000641e00be0 4 3471 null dead sun/misc/Launcher
AppClassLoader@0x00000007c000f688
0x00000006420c3668 1 1476 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3a68 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de29b8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de42b8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de46b8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c4860 1 880 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3360 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3bb0 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c4478 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e2f78 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de34a8 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006421a1a60 0 0 0x0000000641e00b80 dead java/util/ResourceBundle$RBClassLoader@0x00000007c00bff00
0x00000006420c3d70 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006440d6670 1 1483 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e4170 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de2da0 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c3988 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000736954810 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3d88 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3958 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006440d6c80 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3680 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3250 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006440d6398 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3298 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e4b98 1 1505 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de2b48 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de4448 1 1474 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c4090 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3d40 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000738f16450 1 880 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c3ca8 1 1476 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006440d65a8 1 880 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000736959230 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e40a8 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3c78 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e39a0 1 1485 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3570 1 1471 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e35b8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de2e68 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c43b0 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e2eb0 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de4060 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c3fc8 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3318 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c38c0 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3cc0 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de2c10 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006440d6ed8 1 1499 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e38d8 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e51d8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3e08 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e31d0 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3700 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c42e8 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c4de8 4 4029 null dead javax/management/remote/rmi/NoCallStackClassLoader@0x00000007c00a8fd8
0x00000006430e2de8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3638 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c3be0 1 1471 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006440d64e0 1 1473 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e26e0 1 880 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3fe0 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de2f30 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c33f8 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006420c37f8 1 1474 null dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e3bf8 1 1473 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de2828 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de4128 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de4528 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x00000006430e34f0 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
0x0000000643de3a20 1 880 0x0000000641e00b80 dead sun/reflect/DelegatingClassLoader@0x00000007c0009df8
total = 118 11669 20043639 N/A alive=1, dead=117 N/A
生成java堆的快照
[@82995c215909 /opt/logs]$ jmap -dump:format=b,file=/tmp/text1 12527
Dumping heap to /tmp/text1 …
Heap dump file created