//在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
Java 檢視JVM的狀態
我們寫的 都是執行在jvm上面的,雖然 的邏輯我們是知道的,但是jvm對我們來講就像是乙個黑盒。通常情況下會用qps rt這些指標來反應程式效能和質量,但是在出現效能問題的時候我們怎麼取檢視到底是 處理問題?這應該是最常用也是最方便的工具,用法如下 jstat t h 通過option引數可以看到不...
檢視設定JVM記憶體資訊
檢視設定jvm記憶體資訊 runtime.getruntime maxmemory 最大可用記憶體,對應 xmx runtime.getruntime freememory 當前jvm空閒記憶體 runtime.getruntime totalmemory 當前jvm占用的記憶體總數,其值相當於當前...
jvm程序狀態檢視命令 jps
jps可以用來檢視jvm的程序狀態,啟動命令等資訊。用法 q只列印執行中的jvm程序pid。他的特性決定了不能與 mlvv 一起使用。m輸出傳遞給main方法的引數。嵌入式jvm的輸出可能為null。l將應用程式主類的完整包名稱或完整路徑名稱輸出到應用程式的jar檔案。v輸出啟動jvm時手動指定的j...