CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit

-Xms / -Xmx

These Oracle® HotSpot™ options set the initial/minimum Java™ heap size, and the maximum heap size respectively. These options are recognized by the OpenJ9 VM.


  • If you set -Xms > -Xmx, the OpenJ9 VM fails with the message -Xms too large for -Xmx.
  • If you exceed the limit set by the -Xmx option, the OpenJ9 VM generates an OutofMemoryError.
  • If you set a value for -Xms, the -XX:InitialRAMPercentage option is ignored.
  • If you set a value for -Xmx, the -XX:MaxRAMPercentage option is ignored.

If you are allocating the Java heap with large pages, see also -Xlp and More effective heap usage using compressed references.

You can also use the -Xmo option (not supported by the balanced garbage collection policy):
If the scavenger is enabled, -Xms-Xmn + -Xmo
If the scavenger is disabled, -Xms-Xmo


Setting Effect Default
-Xms<size> Set initial heap size 8 MB
-Xmx<size> Set maximum heap size 25% of available memory (25 GB maximum)

See Using -X command-line options for more information about the <size> parameter.
See Default settings for the OpenJ9 VM for more about default values.


-Xms2m -Xmx64m
Heap starts at 2 MB and grows to a maximum of 64 MB.
-Xms100m -Xmx100m
Heap starts at 100 MB and never grows.
Heap starts at 50 MB and grows to the default maximum.
Heap starts at default initial value and grows to a maximum of 256 MB.

See also