//在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-b17using parallel threads in the new generation.using thread-local object allocation.Concurrent Mark-Sweep GCHeap Configuration:MinHeapFreeRatio = 40MaxHeapFreeRatio = 70MaxHeapSize = 5368709120 (5120.0MB)NewSize = 1073741824 (1024.0MB)MaxNewSize = 1073741824 (1024.0MB)OldSize = 5439488 (5.1875MB)NewRatio = 2SurvivorRatio = 8PermSize = 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% usedEden Space:capacity = 859045888 (819.25MB)used = 203344848 (193.9247589111328MB)free = 655701040 (625.3252410888672MB)23.671011157904523% usedFrom Space:capacity = 107347968 (102.375MB)used = 79484312 (75.8021469116211MB)free = 27863656 (26.572853088378906MB)74.04361114688263% usedTo Space:capacity = 107347968 (102.375MB)used = 0 (0.0MB)free = 107347968 (102.375MB)0.0% usedconcurrent mark-sweep generation:capacity = 4294967296 (4096.0MB)used = 46904664 (44.731773376464844MB)free = 4248062632 (4051.268226623535MB)1.0920843109488487% usedPerm 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
查看JVM各个代的内存状态
最新推荐文章于 2024-04-20 14:43:58 发布