Official Document Address: https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html
The following records are received:
-xx:maxheapsize=Size
Sets the maximum size (in byes) of the memory allocation pool. This value must is a multiple of 1024x768 and greater than 2 MB. Append the Letter k
or k
to indicate kilobytes, m
or m
to indicate megabytes, g
or g
to indicate gigabytes. The default value is chosen in runtime based on system configuration. For server Deployments, -xx:initialheapsize
and -XX: Maxheapsize
are often set to the same value. See the sections "Ergonomics" IN  Java SE HotSpot Virtual machine Garbage Collection Tuning guide at ; http://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/index.html
.
The following examples show how to set the maximum allowed a size of allocated memory to a MB using various units:
-xx:maxheapsize=83886080-xx:maxheapsize=81920k-xx:maxheapsize=80m
On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper limit for this value is approximately 4,000 MB minus O Verhead amounts. On Oracle Solaris 2.6 and x86 platforms, the upper limit is approximately 2,000 MB minus overhead amounts. On Linux platforms, the upper limit is approximately 2,000 MB minus overhead amounts.
The -XX:MaxHeapSize
option is equivalent to -Xmx
.
This is roughly the following:
- The maximum heap memory setting on a Linux operating system is 2 G.
-XX:MaxHeapSize
equivalent to-Xmx
- This value must be a multiple of 1024 and greater than 2 MB
Heap memory configuration for Java virtual machines