查看Java进程的heapsize
发布时间:2015-07-08 02:31 标签: java linux 阅读(2925)
在Java启动的时候设置了heapsize,但是不确定是否生效了。可以通过jmap来获取heapsize的大小,一段小脚本如下,PID为java进程的进程id
jmap -heap PID
例子:
[root@localhost /]# jmap -heap 22199 Attaching to process ID 22199, please wait... Debugger attached successfully. Server compiler detected. JVM version is 20.0-b12 using thread-local object allocation. Parallel GC with 18 thread(s) Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 536870912 (512.0MB) NewSize = 1310720 (1.25MB) MaxNewSize = 17592186044415 MB OldSize = 5439488 (5.1875MB) NewRatio = 2 SurvivorRatio = 8 PermSize = 21757952 (20.75MB) MaxPermSize = 268435456 (256.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 35586048 (33.9375MB) used = 31090416 (29.650131225585938MB) free = 4495632 (4.2873687744140625MB) 87.36686917299724% used From Space: capacity = 4521984 (4.3125MB) used = 1507584 (1.437744140625MB) free = 3014400 (2.874755859375MB) 33.33899456521739% used To Space: capacity = 4390912 (4.1875MB) used = 0 (0.0MB) free = 4390912 (4.1875MB) 0.0% used PS Old Generation capacity = 171442176 (163.5MB) used = 143097824 (136.46871948242188MB) free = 28344352 (27.031280517578125MB) 83.4671067170776% used PS Perm Generation capacity = 89260032 (85.125MB) used = 89187880 (85.05619049072266MB) free = 72152 (0.06880950927734375MB) 99.9191665089253% used
显示的单位为MB