-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 Eclipse OpenJ9™ VM.

Notes:

For the gencon GC policy, you can also use the -Xmo option:

Syntax

Setting Effect Default
-Xms<size> Set initial heap size 8 MB
-Xmx<size> Set maximum heap size Half the available memory with a minimum of 16 MB and a maximum of 512 MB

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.

The -Xmx option can be used with all OpenJ9 GC policies. However, the -Xms option can be used with all GC policies except for the metronome GC policy because the heap is always fully expanded.

Examples

-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.
-Xms50m
Heap starts at 50 MB and grows to the default maximum.
-Xmx256m
Heap starts at default initial value and grows to a maximum of 256 MB.

See also