What is the meaning of the -XX:NewRatio and -XX:OldSize JVM flags?
Asked Answered
E

2

24

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 ?

Eusporangiate answered 28/7, 2011 at 13:25 Comment(0)
K
28

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

The default value is 2.

Kinase answered 28/7, 2011 at 13:32 Comment(6)
The 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?Engrain
@Engrain Good point. I am not sure. I would have to run it and check. I thought it was the other way around.Kinase
I'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.)Castle
I 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.Kinase
However, according to this doc, "..., setting -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3"Additory
@Additory 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."Kinase
M
1

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.

Manutius answered 9/4, 2014 at 18:56 Comment(2)
does it mean that the size will grow from there? do you have any links related to OldSize that I can refer to? thanksExternalize
Do not remember if it only grows or reduces as well. It was a long time ago. Sorry.Manutius

© 2022 - 2024 — McMap. All rights reserved.