The command-line flags to tune the generation sizes all adjust the size of the young genera-
tion; the old generation gets everything that is left over. There are a variety of flags that can
be used to size the young generation:
Set the ratio of the young generation to the old generation.
Set the initial size of the young generation.
Set the maximum size of the young generation.
Shorthand for setting both NewSize and MaxNewSize to the same value.
The young generation is first sized by the NewRatio , which has a default value of 2. Para-
meters that affect the sizing of heap spaces are generally specified as ratios; the value is used
in an equation to determine the percentage of space affected. The NewRatio value is used in
Initial Young Gen Size = Initial Heap Size / (1 + NewRatio)
Plugging in the initial size of the heap and the NewRatio yields the value that becomes the
setting for the young generation. By default, then, the young generation starts out at 33% of
the initial heap size.
Alternately, the size of the young generation can be set explicitly by specifying the NewSize
flag. If that option is set, it will take precedence over the value calculated from the NewRa-
tio . There is no default for this flag (though PrintFlagsFinal will report a value of 1 MB).
If the flag isn't set, the initial young generation size will be based on the NewRatio calcula-
As the heap expands, the young generation size will expand as well, up to the maximum size
specified by the MaxNewSize flag. By default, that maximum is also set using the NewRatio
value, though it is based on the maximum (rather than initial) heap size.