Reputation: 1527
I have server (oracle/sun) JVM running, how do I check which GC it uses at runtime? Eg, if it is using UseG1GC UseConcMarkSweepGC. (jdk is 1.7_79)
I know I can use the jinfo <pid>
to check the VM Flags from the output. But what if the JVM is started without these parameters.
I can't find this info in jvisualvm
either.
Upvotes: 1
Views: 2600
Reputation: 11547
use JMap.
jMap - start this tool with -heap options and find a string dedicated to a Garbage Collector type. like
$ 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.
Upvotes: 5