This page tries to summarize the changes of the relation between -Xms and -XX:InitialHeapSize in the changeset for 8006088.
Generally -Xms sets both minimum and initial heap size, while -XX:InitialHeapSize only sets initial heap size. The table below shows for all input combinations of -Xms and -XX:InitialHeapSize in the first two columns the resulting minimum and initial heap size in a current patch compared to the current (old) behavior.
The input values have the following meaning:
Input value meaning |
|
---|---|
not set |
the value has not been set on the command line |
0 |
value=0 set on the command line |
S |
value < NewSize + OldSize |
X |
value >= NewSize + OldSize |
The output values have the following meaning:
Output value meaning |
|
---|---|
Ergo |
value has been chosen ergonomically. The ergonomics for minimum
and initial heap size are different. For minimum heap size, the VM
typically chooses NewSize + OldSize, for initial heap size a
fraction of physical memory or maximum heap size. The string may
contain additional constraints for the value. |
S, X |
the value S or X |
Error |
the VM prints some error message |
Here is the table.
Bold cells indicate that the behavior seems unexpected.
Input values |
|
New behavior |
|
Old behavior |
|
---|---|---|---|---|---|
-Xms |
-XX:InitialHeapSize |
Minimum Heap Size |
Initial Heap Size |
Minimum Heap Size |
Initial Heap Size |
not set |
not set |
Ergo |
Ergo |
Ergo |
Ergo |
not set |
S |
S |
S |
Error |
Error |
not set |
X |
Ergo <= X |
X |
Ergo <= X |
X |
not set |
0 |
Ergo |
Ergo |
Ergo |
NewSize + OldSize |
0 |
not set |
Ergo |
Ergo |
Error |
Error |
0 |
S |
S |
S |
Error |
Error |
0 |
X |
Ergo <= X |
X |
Error |
Error |
0 |
0 |
Ergo |
Ergo |
Error |
Error |
S |
not set |
S |
S |
S |
S |
S_1 |
S_2 |
S_1 |
S_2 |
S_1 |
S_2 |
S |
X |
S |
X |
S |
X |
S |
0 |
S |
Ergo |
S |
Ergo |
X |
not set |
X |
X |
X |
X |
X |
S |
Error |
Error |
Error |
Error |
X_1 |
X_2 |
X_1 |
X_2 |
X_1 |
X_2 |
X |
0 |
X |
Ergo >= X |
Error |
Error |
Additional notes:
the S_1/S_2 and X_1/X_2 rows only give that result if S_1 <= S_2 or X_1 <= X_2 respectively. Otherwise they give a VM error.
the relative positions of -Xms and -XX:InitialHeapSize matters, as -Xms sets both minimum and initial heap size. This apparently cannot be changed as -Xms is a cross-VM switch, and there does not seem to be a common definition for that switch.
you can set only minimum heap size by providing -Xms<minimum> and -XX:InitialHeapSize=0 afterwards on the command line