查看JVM使用的默认的垃圾收集器
一、方法一
打印虚拟机所有参数
1 [jms_appus@zb_10-0-55-107_lin ~]$ java -XX:+PrintFlagsFinal -version | grep : 2 intx CICompilerCount := 2 {product} 3 uintx InitialHeapSize := 62914560 {product} 4 uintx MaxHeapSize := 1006632960 {product} 5 uintx MaxNewSize := 335544320 {product} 6 uintx MinHeapDeltaBytes := 524288 {product} 7 uintx NewSize := 20971520 {product} 8 uintx OldSize := 41943040 {product} 9 bool PrintFlagsFinal := true {product} 10 bool UseCompressedClassPointers := true {lp64_product} 11 bool UseCompressedOops := true {lp64_product} 12 bool UseParallelGC := true {product} 13 java version "1.8.0_45" 14 Java(TM) SE Runtime Environment (build 1.8.0_45-b14) 15 Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
二、方法二
1 [jms_appus@zb_10-0-55-107_lin ~]$ java -XX:+PrintCommandLineFlags -version 2 -XX:InitialHeapSize=62793728 -XX:MaxHeapSize=1004699648 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC 3 java version "1.8.0_45" 4 Java(TM) SE Runtime Environment (build 1.8.0_45-b14) 5 Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
参数解读:
针对上述的-XX:UseParallelGC,这边我们引用《深入理解Java虚拟机:JVM高级特性与最佳实践》的介绍:
郭慕荣博客园