jmap介绍

jmap:查看整个堆及内存对象
基本用法:
jmap [-option] pid
重点用法:
to print same info as Solaris pmap
-heap to print java heap summary
-histo[:live] to print histogram of java object heap; if the “live”
suboption is specified, only count live objects
-finalizerinfo to print information on objects awaiting finalization

查看堆内存: jmap --heap pid

/nemo/jdk/bin/jmap -heap 239637

Attaching to process ID 239637, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 24.65-b04

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

Heap Configuration:(堆配置参数,一般是由启动指定)
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 3221225472 (3072.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 268435456 (256.0MB)
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:(当前堆的使用情况)
PS Young Generation
Eden Space:
capacity = 694681600 (662.5MB)
used = 601048312 (573.2043380737305MB)
free = 93633288 (89.29566192626953MB)
86.52140952056308% used
From Space:
capacity = 10485760 (10.0MB)
used = 2850816 (2.71875MB)
free = 7634944 (7.28125MB)
27.1875% used
To Space:
capacity = 9961472 (9.5MB)
used = 0 (0.0MB)
free = 9961472 (9.5MB)
0.0% used
PS Old Generation
capacity = 1431830528 (1365.5MB)
used = 120644408 (115.05547332763672MB)
free = 1311186120 (1250.4445266723633MB)
8.42588599982693% used
PS Perm Generation
capacity = 71827456 (68.5MB)
used = 71416272 (68.10786437988281MB)
free = 411184 (0.3921356201171875MB)
99.42753924070483% used

41145 interned Strings occupying 5023944 bytes.

/nemo/jdk/bin/jmap -histo 239637

对象的个数 对象占用的字节数 类名

num #instances #bytes class name

1: 172505 215674400 [B
2: 1747475 184431640 [C
3: 3434327 89150104 [Ljava.lang.Object;
4: 3138276 75804224 [Ljava.lang.String;
5: 1056366 25352784 java.lang.String
6: 37782 17923296 [I
7: 120814 16995312
8: 120814 15477472
9: 12792 14843440
10: 12471 8735960
11: 10879 7859744
12: 219728 7031296 java.lang.StackTraceElement
13: 164575 5266400 java.io.FileOutputStream
14: 212413 5097912 java.io.FileDescriptor
15: 203088 4874112 java.lang.StringBuffer
16: 298610 4777760 java.lang.Integer
17: 266729 4267664 java.lang.Object
18: 124636 3988352 java.util.HashMap E n t r y 19 : 1230073936224 j a v a . u t i l . A r r a y L i s t Entry 19: 123007 3936224 java.util.ArrayList Entry19:1230073936224java.util.ArrayListItr
20: 159025 3816600 java.lang.StringBuilder
21: 148679 3568296 java.util.ArrayList
22: 212994 3407904 java.util.concurrent.atomic.AtomicInteger
23: 25295 2665944 [Ljava.util.HashMap E n t r y ; 24 : 628122512480 j a v a . u t i l . H a s h M a p Entry; 24: 62812 2512480 java.util.HashMap Entry;24:628122512480java.util.HashMapKeyIterator
25: 73859 2363488 java.util.concurrent.locks.AbstractQueuedSynchronizer N o d e 26 : 218072321368 [ L j a v a . l a n g . S t a c k T r a c e E l e m e n t ; 27 : 716722293504 j a v a . u t i l . c o n c u r r e n t . C o n c u r r e n t H a s h M a p Node 26: 21807 2321368 [Ljava.lang.StackTraceElement; 27: 71672 2293504 java.util.concurrent.ConcurrentHashMap Node26:218072321368[Ljava.lang.StackTraceElement;27:716722293504java.util.concurrent.ConcurrentHashMapHashEntry
28: 3638 2086128
29: 38223 1834704 java.util.HashMap
30: 74605 1790520 cn.seczone.iast.thirdparty.org.apache.http.util.CharArrayBuffer
31: 26631 1706960 [S
32: 34762 1668576 java.lang.management.MemoryUsage
33: 20738 1659040 java.lang.reflect.Method
34: 12995 1552552 java.lang.Class
35: 12094 1354528 java.net.SocksSocketImpl

当前正在回收的情况

/nemo/jdk/bin/jmap -finalizerinfo 239637

Attaching to process ID 239637, please wait…
Debugger attached successfully.
Server compiler detected.
JVM version is 24.65-b04
Number of objects pending for finalization: 0

上一篇:CSS系列 (03):CSS三大特性


下一篇:笔记:Maven 项目基本配置