查看JVM各个代的内存状态

来源:互联网 发布:淘宝上怎么实名认证 编辑:程序博客网 时间:2024/05/16 19:03
//在Linux执行 jmap -heap [pid]
//可以看到如下信息
Attaching to process ID 23990, please wait...
Warning: the type "const char*" (declared in the remote VM in VMStructs::localHotSpotVMTypes) had its size declared as 8 twice. Continuing.
Warning: the type "const size_t" (declared in the remote VM in VMStructs::localHotSpotVMTypes) had its size declared as 8 twice. Continuing.
Warning: the type "const int" (declared in the remote VM in VMStructs::localHotSpotVMTypes) had its size declared as 4 twice. Continuing.
Warning: the type "const MemRegion" (declared in the remote VM in VMStructs::localHotSpotVMTypes) had its size declared as 16 twice. Continuing.
Debugger attached successfully.
Server compiler detected.
JVM version is 21.0-b17
using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 5368709120 (5120.0MB)
NewSize = 1073741824 (1024.0MB)
MaxNewSize = 1073741824 (1024.0MB)
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 536870912 (512.0MB)
MaxPermSize = 536870912 (512.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 966393856 (921.625MB)
used = 282829160 (269.7269058227539MB)
free = 683564696 (651.8980941772461MB)
29.266448482056575% used
Eden Space:
capacity = 859045888 (819.25MB)
used = 203344848 (193.9247589111328MB)
free = 655701040 (625.3252410888672MB)
23.671011157904523% used
From Space:
capacity = 107347968 (102.375MB)
used = 79484312 (75.8021469116211MB)
free = 27863656 (26.572853088378906MB)
74.04361114688263% used
To Space:
capacity = 107347968 (102.375MB)
used = 0 (0.0MB)
free = 107347968 (102.375MB)
0.0% used
concurrent mark-sweep generation:
capacity = 4294967296 (4096.0MB)
used = 46904664 (44.731773376464844MB)
free = 4248062632 (4051.268226623535MB)
1.0920843109488487% used
Perm Generation:
capacity = 536870912 (512.0MB)
used = 81989448 (78.19123077392578MB)
free = 454881464 (433.8087692260742MB)
15.27172476053238% used
 
导出整个JVM的内存
jmap -dump:format=b,file=memory.log [pid]
 
使用JHat分析JVM堆dump文件的工具,基于此工具可以分析JVM heap中对象占用状况
jhat -J-Xmx1024M [file]
执行后等待console中输出Started HTTP server on port 7000
然后就可以使用浏览器访问HTTP://ip:7000
 
原创粉丝点击