Xmx specifies the maximum memory allocation pool for a Java virtual machine (JVM), while
Xms specifies the initial memory allocation pool.
This means that your JVM will be started with
Xms amount of memory and will be able to use a maximum of
Xmx amount of memory. For example, starting a JVM like below will start it with 256 MB of memory and will allow the process to use up to 2048 MB of memory:
java -Xms256m -Xmx2048m
The memory flag can also be specified in different sizes, such as kilobytes, megabytes, and so on.
-Xmx1024k -Xmx512m -Xmx8g
Xms flag has no default value, and
Xmx typically has a default value of 256 MB. A common use for these flags is when you encounter a
When using these settings, keep in mind that these settings are for the JVM's heap , and that the JVM can/will use more memory than just the size allocated to the heap. From Oracle's documentation:
Note that the JVM uses more memory than just the heap. For example Java methods, thread stacks and native handles are allocated in memory separate from the heap, as well as JVM internal data structures.