Lijie Xu
Lijie Xu

Reputation: 250

Adaptive Sizing in JVM garbage collectors

For Oracle JVM 1.8 Server mode, can Parallel, CMS, and G1 collectors dynamically change the ratio of the young generation to old generation? What is the default ratio of the young generation to old generation in these three collectors?

Parallel = -XX:+UseParallelGC -XX:+UseParallelOldGC

CMS = -XX:+UseConcMarkSweepGC

G1 = -XX:+UseG1GC

Upvotes: 3

Views: 883

Answers (2)

the8472
the8472

Reputation: 43052

Defaults are often version- and machine-dependent or can change in response to other parameters being set. So it is best to just query the JVM.

e.g. use java -XX:+UseG1GC -XX:+PrintFlagsFinal to see the the defaults, including those which are derived based on G1 being selected.

G1 and the parallel collector support adaptive sizing, CMS does not, it adjusts the tenuring thresholds instead during runtime.

Upvotes: 2

Naman
Naman

Reputation: 31888

Well, this might not be able to answer the exact details in terms of what is the ratio of GCs as such but this article named oraclecollectors speaks some volume to be detailed in here:-

Talking about the combinations of the Garbage Collectors, it doesn't explode into a dozen combinations because not all of these collectors work with each other.

  • G1 is effectively an antisocial collector that doesn't like working with anyone else.

  • The serial collectors are the "last man picked" collectors

  • The 'PS' collectors like to work with each other;

  • The ParNew and Concurrent collectors works good together.

From Java9 onwards(with the addition of being able to turn off adaptive sizing policy) and JEP 248:Making G1 the default Garbage Collector, that's pretty much it there would just be one GC. Until now though still there is a possible list author had come up with in terms of garbage collection algorithm options. Sharing a screen from the linked article itself:

enter image description here

Hope that helps.

Upvotes: 0

Related Questions