If I omit the -Xmxn option from the Java command line a default value is used. According to Java documentation "the default value is chosen at runtime based on system configuration".
What system configuration settings influence the default value?
If I omit the -Xmxn option from the Java command line a default value is used. According to Java documentation "the default value is chosen at runtime based on system configuration".
What system configuration settings influence the default value?
Java 8 takes more than 1/6th of your physical memory for your Xmssize (Minimum HeapSize) and less than 1/4th of your physical memory for your -Xmxsize (Maximum HeapSize).
You can Check the default Java heap size by:
In Windows:
In Linux:
Your physical memory and your Java version.
Have a look at documentation page
Client JVM Default Initial and Maximum Heap Sizes:
The default maximum heap size is half of the physical memory up to a physical memory size of 192 megabytes (MB) and otherwise one fourth of the physical memory up to a physical memory size of 1 gigabyte (GB).
Server JVM Default Initial and Maximum Heap Sizes:
On 32-bit JVMs, the default maximum heap size can be up to 1 GB if there is 4 GB or more of physical memory. On 64-bit JVMs, the default maximum heap size can be up to 32 GB if there is 128 GB or more of physical memory
You can specify the initial and maximum heap sizes using the flags -Xms (initial heap size) and -Xmx (maximum heap size). If you know how much heap your application needs to work well, you can set -Xms and -Xmx to the same value
Ernesto is right. According to the link he posted [1]:
[1] http://www.oracle.com/technetwork/java/javase/6u18-142093.html
On Windows systems, you can use the following command to find out the defaults on the system where your applications runs.
Look for the options
MaxHeapSize
(for-Xmx
) andInitialHeapSize
for-Xms
.On a Unix/Linux system, you can do
I believe the resulting output is in bytes.
For the IBM JVM, the command is the following:
For more information about the IBM SDK for Java 8 - http://www-01.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.lnx.80.doc/diag/appendixes/defaults.html?lang=en
According to Garbage Collector Ergonomics [Oracle]:
UPDATE:
As pointed out by Tom Anderson in his comment, the above is for server-class machines. From Ergonomics in the 5.0 JavaTM Virtual Machine: