java 查看垃圾收集器_JVM系列:查看JVM使用的什么垃圾收集器
一、方法一
打印虛擬機所有參數(shù)
[root@localhost ~]# java -XX:+PrintFlagsFinal -version | grep :
uintx InitialHeapSize := 258689024 {product}
uintx MaxHeapSize := 4139778048 {product}
bool PrintFlagsFinal := true {product}
bool UseCompressedOops := true {lp64_product}
bool UseParallelGC := true {product}
二、方法二
[root@localhost ~]# java -XX:+PrintCommandLineFlags -version
-XX:InitialHeapSize=258689024 -XX:MaxHeapSize=4139024384 -XX:+PrintCommandLineFlags -XX:+UseCompressedOops-XX:+UseParallelGC
參數(shù)解讀:
針對上述的-XX:UseParallelGC,這邊我們引用《深入理解Java虛擬機:JVM高級特性與最佳實踐》的介紹:
也就是說,打開此開關(guān),使用的垃圾收集器是:新生代(Parallel Scavenge),老年代(Ps MarkSweep)組合。
jdk1.7 默認垃圾收集器Parallel Scavenge(新生代)+Parallel Old(老年代)
jdk1.8 默認垃圾收集器Parallel Scavenge(新生代)+Parallel Old(老年代)
jdk1.9 默認垃圾收集器G1
三、方法三:
[root@iZ2zeapchxZ tomcat7]# jmap -heap 13297
Attaching to process ID 13297, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.77-b03
using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 1073741824 (1024.0MB)
NewSize = 87228416 (83.1875MB)
MaxNewSize = 87228416 (83.1875MB)
OldSize = 986513408 (940.8125MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 78512128 (74.875MB)
used = 17016048 (16.227767944335938MB)
free = 61496080 (58.64723205566406MB)
21.673145835507096% used
Eden Space:
capacity = 69795840 (66.5625MB)
used = 10923608 (10.417564392089844MB)
free = 58872232 (56.144935607910156MB)
15.650800964642018% used
From Space:
capacity = 8716288 (8.3125MB)
used = 6092440 (5.810203552246094MB)
free = 2623848 (2.5022964477539062MB)
69.89718559093045% used
To Space:
capacity = 8716288 (8.3125MB)
used = 0 (0.0MB)
free = 8716288 (8.3125MB)
0.0% used
concurrent mark-sweep generation:
capacity = 986513408 (940.8125MB)
used = 41311272 (39.397499084472656MB)
free = 945202136 (901.4150009155273MB)
4.187603702594583% used
19916 interned Strings occupying 2422360 bytes.
Concurrent Mark-Sweep GC:CMS回收器
Mark Sweep Compact GC:串行GC(Serial GC)
Parallel GC with 2 thread(s):并行GC(ParNew)
如何修改GC回收器:設(shè)置 JAVA_OPTS
總結(jié)
以上是生活随笔為你收集整理的java 查看垃圾收集器_JVM系列:查看JVM使用的什么垃圾收集器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 聘用计算机高级职称,关于咨询高级职称聘用
- 下一篇: django返回指定html文件,Dja