What is the meaning of the -XX:NewRatio and -XX:OldSize JVM flags?
Solution 1
The NewRatio is the ratio of old generation to young generation (e.g. value 2 means max size of old will be twice the max size of young, i.e. young can get up to 1/3 of the heap).
The OldSize is not one of the documented options, but I assume it's the size of the tenured space http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
Solution 2
Since NewRatio is already well explained, the following should help with OldSize.
Here, OldSize => default size of the tenured generation. This is the default size of tenured till the time ergonomics comes into play.
dacanalr
Updated on July 19, 2022Comments
-
dacanalr almost 2 years
I am starting my java app with the following command line :
java -XX:+PrintCommandLineFlags -verbose:gc -XX:+PrintGCDetails \ -XX:+UseConcMarkSweepGC -jar start.jar
The JVM enables the following options:
-XX:MaxNewSize=87244800 -XX:MaxTenuringThreshold=4 -XX:NewRatio=7 -XX:NewSize=21811200 -XX:OldPLABSize=16 -XX:OldSize=65433600 -XX:+PrintCommandLineFlags -XX:+PrintGC -XX:+PrintGCDetails -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
Can anyone explains me the meaning of NewRatio and OldSize ? In particular OldSize is the initial size of the tenured generation ?
-
DeepNightTwo almost 11 yearsThe doc says "Ratio of new/old generation sizes. The default value is 2.". So does 2 means new gen size is twice as big as old gen?
-
Vishy almost 11 years@DeepNightTwo Good point. I am not sure. I would have to run it and check. I thought it was the other way around.
-
Jim Pivarski over 10 yearsI've verified with the VisualGC plugin for JVisualVM that a higher value of
-XX:NewRatio
results in a larger "old" generation size, so the ratio must have "old" in the numerator, not the denominator. (Tested with Sun HotSpot JVM version 1.6.0_45.) -
Vishy over 10 yearsI have also check with the Oracle guys this week there is no way with a ratio to make the new size larger than the old size.
-
Tim over 9 years@PeterLawrey Can you update the text of your answer to say "ratio of old generation to young generation" to make it consistent with your parenethetical example? Right now your text says young/old but your example says old/young.
-
Kin Cheung about 7 yearsdoes it mean that the size will grow from there? do you have any links related to OldSize that I can refer to? thanks
-
Khanna111 about 7 yearsDo not remember if it only grows or reduces as well. It was a long time ago. Sorry.
-
wings over 5 yearsHowever, according to this doc, "..., setting -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3"
-
Vishy over 5 years@wings It is confusing as it goes on to say "... the combined size of eden and the survivor spaces will be fourth of the heap." i.e. the ratio of old to new is 3:1 making the young space 1/4th of the heap. Also "The default NewRatio for the Server JVM is 2: the old generation occupies 2/3 of the heap while the new generation occupies 1/3."