常见jvm命令

1.查询堆内存分配情况
[root@best-account-86949f5646-d8xjl bestapp]# jps
1 jar
547679 Jps
[root@best-account-86949f5646-d8xjl bestapp]# ps -ef|grep java
root 1 0 18 12:24 ? 01:04:52 java -Dserver.port=8080 -Dspring.config.location=/,classpath:/config/,file:./,file:./config/,/bestapp/config/ -Dspring.profiles.active=q9prod,log-prod,ossprod -Xmn3g -Xms3g -Xmx3g -jar china.jar
root 547927 547583 0 18:13 pts/0 00:00:00 grep --color=auto java
[root@best-account-86949f5646-d8xjl bestapp]# jmap -heap 1
Attaching to process ID 1, please wait...
^GDebugger attached successfully.
Server compiler detected.
JVM version is 25.144-b01

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

Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 3221225472 (3072.0MB)
NewSize = 3220701184 (3071.5MB)
MaxNewSize = 3220701184 (3071.5MB)
OldSize = 524288 (0.5MB)
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 = 2928672768 (2793.0MB)
used = 964782328 (920.0881271362305MB)
free = 1963890440 (1872.9118728637695MB)
32.942646872045486% used
From Space:
capacity = 143654912 (137.0MB)
used = 0 (0.0MB)
free = 143654912 (137.0MB)
0.0% used
To Space:
capacity = 143130624 (136.5MB)
used = 0 (0.0MB)
free = 143130624 (136.5MB)
0.0% used
PS Old Generation
capacity = 524288 (0.5MB)
used = 487176 (0.46460723876953125MB)
free = 37112 (0.03539276123046875MB)
92.92144775390625% used

原文地址:https://www.cnblogs.com/xiaohan970121/p/12856538.html