How To Change the Default Maximum Java Heap For Java Commands On a Server With a Lot of RAM
Last updated on NOVEMBER 05, 2016
Applies to:Java SE JDK and JRE - Version 5.0 and later
Information in this document applies to any platform.
In Java SE 5.0, a new performance feature for self tuning of the Java Virtual Machine (JVM) known as JVM Ergonomics was added. This is also present in Java SE 6 and Java SE 7. The idea is that when a Java process gets started, it can examine the underlying system resources and adjust itself for better performance. You can do something similar with the setting of the various JVM flags. One such flag controls the maximum heap size for the process.
The JVM ergonomics are subject to change. They can even change between Java update releases. For example starting with Java SE 6 update 18 (6u18), the default maximum heap size is half of the physical memory up to a physical memory size of 192 megabytes and otherwise one fourth of the physical memory up to a physical memory size of 4 gigabytes for the 32-bit JVMs and up to a physical memory size of 128 gigabytes for the 64-bit JVMs. See also the Java 6u18 Release Notes.
On well equipped servers with a lot of physical memory, even a very simple Java program could reserve gigabytes of memory for the Java heap by default due to the JVM ergonomics.
Therefore we recommend that you do not rely on the default values of the JVM ergonomics for a production system. In any case, setting at least the maximum of the Java heap value is good practice.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms