➜ Contents java -XX:+PrintCommandLineFlags -version -XX:InitialHeapSize=536870912 -XX:MaxHeapSize=8589934592 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
UseParallelGC 即 Parallel Scavenge + Parallel Old,再查看详细信息
➜ Contents java -XX:+PrintGCDetails -version java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode) Heap PSYoungGen total 153088K, used 5263K [0x0000000715580000, 0x0000000720000000, 0x00000007c0000000) eden space 131584K, 4% used [0x0000000715580000,0x0000000715aa3ef8,0x000000071d600000) from space 21504K, 0% used [0x000000071eb00000,0x000000071eb00000,0x0000000720000000) to space 21504K, 0% used [0x000000071d600000,0x000000071d600000,0x000000071eb00000) ParOldGen total 349696K, used 0K [0x00000005c0000000, 0x00000005d5580000, 0x0000000715580000) object space 349696K, 0% used [0x00000005c0000000,0x00000005c0000000,0x00000005d5580000) Metaspace used 2245K, capacity 4480K, committed 4480K, reserved 1056768K class space used 243K, capacity 384K, committed 384K, reserved 1048576K
从JDK7u4开始,就对 “-XX:+UseParallelGC” 默认的老年代收集器进行了改进,改进使得HotSpot VM在选择使用 “-XX:+UseParallelGC” 时,会默认开启 " -XX:+UseParallelOldGC “,也就是说默认的老年代收集器是 Parallel Old。
综上,JDK8中默认的选择是”-XX:+UseParallelGC",是 Parallel Scavenge + Parallel Old组合。
参考
- https://bugs.openjdk.java.net/browse/JDK-6679764
- http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/rev/24cae3e4cbaa