JVM parameter view

The situation of updating JDK 1.8 HotSpot is as follows:
You can execute the following commands under Linux to view the default values ​​of Xms and Xmx
java -XX:+PrintFlagsFinal -version | grep HeapSize

In addition, this is the description of Default Heap Size in the Java8 documentation: Click here

If the default heap size of the hotspot virtual machine is not specified, they are calculated based on the physical memory of the server. In

client mode, the initial and maximum heap size of the JVM is:
before the physical memory reaches 192MB, the maximum heap size of the JVM is half of the physical memory. Otherwise, when the physical memory is greater than 192MB, before reaching 1GB, the maximum heap size of the JVM is 1/4 of the physical memory, and the physical memory greater than 1GB is also calculated as 1GB. For example, if your computer memory is 128MB, then the maximum heap size The size is 64MB, if your physical memory is greater than or equal to 1GB, then the maximum heap size is 256MB.
Java initial heap size is 1/64 of physical memory, but the minimum is 8MB.

In server mode:
Similar to client mode, the difference is that the default value can be larger. For example, under 32-bit JVM, if the physical memory is 4G or higher, the maximum heap size can be increased to 1GB. If it is under 64-bit JVM, If the physical memory is 128GB or higher, the maximum heap size can be raised to 32GB.


Java8 takes Larger of 1/6th of your physical memory for your Xmssize (Minimum HeapSize) and Smaller of 1/4th of your physical memory for your -Xmxsize (Maximum HeapSize).

You can Check the default java Heap Size by:

In Windows:

java -XX:+PrintFlagsFinal -version | findstr /i "HeapSize PermSize ThreadStackSize"
In Linux:

java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
What system configuration settings influence the default value?
Your physical memory and your Java version.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326345669&siteId=291194637