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 ?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
dacanalr
  • 241
  • 1
  • 2
  • 5

2 Answers2

27

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.

Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • 3
    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? – DeepNightTwo Jul 26 '13 at 06:51
  • @DeepNightTwo Good point. I am not sure. I would have to run it and check. I thought it was the other way around. – Peter Lawrey Jul 26 '13 at 07:26
  • 4
    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.) – Jim Pivarski Sep 25 '13 at 16:56
  • 4
    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. – Peter Lawrey Sep 25 '13 at 18:42
  • However, according to [this doc](https://docs.oracle.com/cd/E19900-01/819-4742/abeik/index.html), "..., setting -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3" – wings Jan 08 '19 at 08:35
  • 2
    @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." – Peter Lawrey Jan 08 '19 at 15:32
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.

Khanna111
  • 3,627
  • 1
  • 23
  • 25