Is G1GC the default in JDK 15 for any machine class/size?

Bruno Borges Bruno.Borges at microsoft.com
Tue Aug 18 22:42:20 UTC 2020


Hi,

Up until JDK 14, SerialGC would be picked by default under certain conditions when the is_server_class_machine() returns false [1][2].

In JDK 15, at least on the binary available in the Docker image 'openjdk/15-jdk-slim', G1GC is being picked no matter how much memory or CPU is available to a container.

I was not able to find in the source code of jdk15 where it is being indicated that G1GC should always be picked.

So I am curious if anyone has observed this change in 15 and if so, where is this happening.

Thanks,
Bruno

$ docker run -ti --memory=256m --cpus=1 openjdk:15-jdk-slim java -XX:+PrintFlagsFinal -version | grep "Use.*GC"
     bool UseAdaptiveSizeDecayMajorGCCost          = true                                      {product} {default}
     bool UseAdaptiveSizePolicyWithSystemGC        = false                                     {product} {default}
     bool UseDynamicNumberOfGCThreads              = true                                      {product} {default}
     bool UseG1GC                                  = true                                      {product} {ergonomic}
     bool UseGCOverheadLimit                       = true                                      {product} {default}
     bool UseMaximumCompactionOnSystemGC           = true                                      {product} {default}
     bool UseParallelGC                            = false                                     {product} {default}
     bool UseSerialGC                              = false                                     {product} {default}
     bool UseShenandoahGC                          = false                                     {product} {default}
     bool UseZGC                                   = false                                     {product} {default}

[1] https://github.com/openjdk/jdk14/blob/master/src/hotspot/share/gc/shared/gcConfig.cpp#L103-L117
[2] https://github.com/openjdk/jdk14/blob/master/src/hotspot/share/runtime/os.cpp#L1604-L1637



More information about the discuss mailing list