0
我有服務器(oracle/sun)JVM正在運行,我該如何檢查它在運行時使用的GC?例如,如果它使用UseG1GC UseConcMarkSweepGC。 (jdk是1.7_79)如何檢查JVM正在使用的GC?
我知道我可以使用jinfo <pid>
來檢查輸出中的VM標誌。但是,如果JVM在沒有這些參數的情況下啓動會怎樣。
我也無法在jvisualvm
中找到此信息。
我有服務器(oracle/sun)JVM正在運行,我該如何檢查它在運行時使用的GC?例如,如果它使用UseG1GC UseConcMarkSweepGC。 (jdk是1.7_79)如何檢查JVM正在使用的GC?
我知道我可以使用jinfo <pid>
來檢查輸出中的VM標誌。但是,如果JVM在沒有這些參數的情況下啓動會怎樣。
我也無法在jvisualvm
中找到此信息。
使用JMap。
jMap - 使用-heap選項啓動此工具並查找專用於垃圾收集器類型的字符串。像
$ jmap -heap 30166
Attaching to process ID 30166, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11
using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 4294967296 (4096.0MB)
NewSize = 1431633920 (1365.3125MB)
MaxNewSize = 1431633920 (1365.3125MB)
OldSize = 2863267840 (2730.625MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 85983232 (82.0MB)
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 1288503296 (1228.8125MB)
used = 339354840 (323.63399505615234MB)
free = 949148456 (905.1785049438477MB)
26.337134026236903% used
Eden Space:
capacity = 1145372672 (1092.3125MB)
used = 313863536 (299.32359313964844MB)
free = 831509136 (792.9889068603516MB)
27.402743550005006% used
From Space:
capacity = 143130624 (136.5MB)
used = 25491304 (24.310401916503906MB)
free = 117639320 (112.1895980834961MB)
17.809818253849016% used
To Space:
capacity = 143130624 (136.5MB)
used = 0 (0.0MB)
free = 143130624 (136.5MB)
0.0% used
concurrent mark-sweep generation:
capacity = 2863333376 (2730.6875MB)
used = 0 (0.0MB)
free = 2863333376 (2730.6875MB)
0.0% used
Perm Generation:
capacity = 23920640 (22.8125MB)
used = 23801432 (22.698814392089844MB)
free = 119208 (0.11368560791015625MB)
99.5016521297089% used
10243 interned Strings occupying 814216 bytes.
正是我想要的,謝謝! – fivelements
http://stackoverflow.com/questions/2498942/how-can-i-see-which-garbage-collector-java-is-using – dawrutowicz