说说jmap命令
jmap命令
ps -ef| grep java
root 1426 1359 0 10:30 pts/0 00:00:00 grep java
root 7807 1 0 Apr28 ? 00:22:52 /usr/java/jdk1.8.0_45/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-8.0.30/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache-tomcat-8.0.30/endorsed -classpath /opt/apache-tomcat-8.0.30/bin/bootstrap.jar:/opt/apache-tomcat-8.0.30/bin/tomcat-juli.jar -Dcatalina.base=/opt/apache-tomcat-8.0.30 -Dcatalina.home=/opt/apache-tomcat-8.0.30 -Djava.io.tmpdir=/opt/apache-tomcat-8.0.30/temp org.apache.catalina.startup.Bootstrap start
jmap 7807
Attaching to process ID 7807, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.45-b02
0x0000000000400000 7K /usr/java/jdk1.8.0_45/bin/java
0x00007f17958dd000 36K /usr/java/jdk1.8.0_45/jre/lib/amd64/libawt_headless.so
0x00007f1795ae4000 754K /usr/java/jdk1.8.0_45/jre/lib/amd64/libawt.so
0x00007f17eaee5000 108K /lib64/libresolv-2.12.so
0x00007f17ecf03000 26K /lib64/libnss_dns-2.12.so
0x00007f17ee21f000 88K /lib64/libgcc_s-4.4.7-20120601.so.1
0x00007f17ee435000 250K /usr/java/jdk1.8.0_45/jre/lib/amd64/libsunec.so
0x00007f17ee97d000 90K /usr/java/jdk1.8.0_45/jre/lib/amd64/libnio.so
0x00007f17eeb8e000 113K /usr/java/jdk1.8.0_45/jre/lib/amd64/libnet.so
0x00007f17eeda5000 48K /usr/java/jdk1.8.0_45/jre/lib/amd64/libmanagement.so
0x00007f180880a000 121K /usr/java/jdk1.8.0_45/jre/lib/amd64/libzip.so
0x00007f1808a25000 64K /lib64/libnss_files-2.12.so
0x00007f1808c33000 220K /usr/java/jdk1.8.0_45/jre/lib/amd64/libjava.so
0x00007f1808e5f000 64K /usr/java/jdk1.8.0_45/jre/lib/amd64/libverify.so
0x00007f180906e000 42K /lib64/librt-2.12.so
0x00007f1809276000 582K /lib64/libm-2.12.so
0x00007f18094fa000 16440K /usr/java/jdk1.8.0_45/jre/lib/amd64/server/libjvm.so
0x00007f180a4c2000 1876K /lib64/libc-2.12.so
0x00007f180a856000 19K /lib64/libdl-2.12.so
0x00007f180aa5a000 100K /usr/java/jdk1.8.0_45/lib/amd64/jli/libjli.so
0x00007f180ac70000 139K /lib64/libpthread-2.12.so
0x00007f180ae8d000 150K /lib64/ld-2.12.so
jmap -heap 7807
Attaching to process ID 7807, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.45-b02
using thread-local object allocation.
Parallel GC with 2 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 1006632960 (960.0MB)
NewSize = 20971520 (20.0MB)
MaxNewSize = 335544320 (320.0MB)
OldSize = 41943040 (40.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 = 122683392 (117.0MB)
used = 84779408 (80.85194396972656MB)
free = 37903984 (36.14805603027344MB)
69.10422561515091% used
From Space: ----------------------------------------年轻代(幸存者乐园1)
capacity = 524288 (0.5MB)
used = 32768 (0.03125MB)
free = 491520 (0.46875MB)
6.25% used
To Space: ------------------------------------------年轻代(幸存者乐园2)
capacity = 38273024 (36.5MB)
used = 0 (0.0MB)
free = 38273024 (36.5MB)
0.0% used
PS Old Generation ----------------------------------老年代(终身颐养园)
capacity = 271581184 (259.0MB)
used = 212289648 (202.45518493652344MB)
free = 59291536 (56.54481506347656MB)
78.16802507201677% used
33603 interned Strings occupying 3737888 bytes.
jmap -histo 7807 | head -30
num #instances #bytes class name
----------------------------------------------
1: 346185 117868872 [B
2: 603520 64592800 [C
3: 145217 13940832 java.util.jar.JarFile$JarFileEntry
4: 578985 13895640 java.lang.String
5: 126460 13392344 [I
6: 200368 8014720 java.util.TreeMap$Entry
7: 247294 7913408 java.util.HashMap$Node
8: 118956 4758240 java.util.HashMap$KeyIterator
9: 21730 3842512 [Ljava.util.HashMap$Node;
10: 100798 3225536 java.io.File
11: 76437 3057480 java.util.HashMap$ValueIterator
12: 39387 2372408 [Ljava.lang.Object;
13: 32109 2054976 java.net.URL
14: 28289 2036808 java.util.regex.Pattern
15: 76439 1834536 org.apache.catalina.LifecycleEvent
16: 62955 1814072 [Ljava.lang.String;
17: 28177 1803328 java.util.regex.Matcher
18: 14724 1665208 java.lang.Class
19: 28161 1577016 [Ljava.util.regex.Pattern$GroupHead;
20: 17892 1574496 java.lang.reflect.Method
21: 76439 1534144 [Lorg.apache.catalina.Container;
22: 30096 1444608 java.util.HashMap
23: 26811 1072440 java.util.LinkedHashMap$Entry
24: 31914 1021248 java.util.concurrent.ConcurrentHashMap$Node
25: 19139 918672 org.apache.catalina.loader.ResourceEntry
26: 35760 858240 java.util.ArrayList
27: 13861 776216 java.util.concurrent.ConcurrentHashMap$ValueIterator
java类型描述符:
jmap -dump:live,format=b,file=/home/temp.hprof 7807
Dumping heap to /home/soft/0503.hprof ...
file size limit
jmap毕竟是命令工具,过于抽象,可以使用jdk自带的visualvm图形界面查看!
C:\Program Files\Java\jdk1.7.0_71\bin\jvisualvm.exe