It varies on implementation and version, but usually it depends on the VM used (e.g. client or server, see -client and -server parameters) and on your system memory.

Often for client the default value is 1/4th of your physical memory or 1GB (whichever is smaller).

Also Java configuration options (command line parameters) can be "outsourced" to environment variables including the -Xmx, which can change the default (meaning specify a new default). Specifically the JAVA_TOOL_OPTIONS environment variable is checked by all Java tools and used if exists (more details here and here).

You can run the following command to see default values:

java -XX:+PrintFlagsFinal -version

It gives you a loooong list, -Xmx is in MaxHeapSize, -Xms is in InitialHeapSize. Filter your output (e.g. |grep on linux) or save it in a file so you can search in it.

Answer from icza on Stack Overflow
🌐
Eclipse OpenJ9 Blog
blog.openj9.org › 2020 › 04 › 30 › default-java-maximum-heap-size-is-changed-for-java-8
Default Java Maximum Heap Size is changed for Java 8 – Eclipse OpenJ9 Blog
April 30, 2020 - From OpenJ9 release 0.20, The default Java Maximum Heap Size (Xmx) is changed to be consistent with Java 11, so by default in Java 8, 25% physical memory up to 25GB for the Xmx will be expected.
🌐
javaspring
javaspring.net › blog › how-to-identify-default-java-heapsize-in-windows
How to Identify Default Java Heap Size in Windows: Command Prompt Method for Eclipse Applications — javaspring.net
Default maximum heap size (-Xmx): 1GB (or 1/4 of system RAM, whichever is smaller). ... Windows OS: Windows 10/11 (32-bit or 64-bit). Eclipse Installed: Any recent version (e.g., Eclipse 2023-09).
Discussions

memory - What is the default max heap size (-Xmx) in Java 8? - Stack Overflow
In the oracle documentation I found: -Xmxsize Specifies the maximum size (in bytes) of the memory allocation pool in bytes ... The default value is chosen at runtime based on system configuration.... More on stackoverflow.com
🌐 stackoverflow.com
Adjust default max heap size when running in container
In non-container scenarios physical memory is shared between multiple applications, therefore it makes sense for JVM to use only a reasonable amount of physical memory for heap, so as to not strang... More on github.com
🌐 github.com
9
March 13, 2018
java - Runtime heap size set in Eclipse - Stack Overflow
In Eclipse, "Windows->Preferences->Java->Installed JREs->Default JVM arguments" sets heap size for applications running in Eclipse, not for Eclipse itself. More on stackoverflow.com
🌐 stackoverflow.com
jvm - How to increase application heap size in Eclipse? - Stack Overflow
Some say I need to do that in Run Configurations for my application. When I open that window, could you please tell me how to set the right argument and the amount of memory? Say how to set 2GB or ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Eclipse Foundation
eclipse.dev › openj9 › docs › xxoriginaljdk8heapsizecompatibilitymode
-XX:[+|-]OriginalJDK8HeapSizeCompatibilityMode -
The default value for the maximum heap size (-Xmx) is 25% of the available memory with a maximum of 25 GB. However, where there is 2 GB or less of physical memory, the value set is 50% of available memory with a minimum value of 16 MB and a maximum value of 512 MB.
Top answer
1 of 5
175

It varies on implementation and version, but usually it depends on the VM used (e.g. client or server, see -client and -server parameters) and on your system memory.

Often for client the default value is 1/4th of your physical memory or 1GB (whichever is smaller).

Also Java configuration options (command line parameters) can be "outsourced" to environment variables including the -Xmx, which can change the default (meaning specify a new default). Specifically the JAVA_TOOL_OPTIONS environment variable is checked by all Java tools and used if exists (more details here and here).

You can run the following command to see default values:

java -XX:+PrintFlagsFinal -version

It gives you a loooong list, -Xmx is in MaxHeapSize, -Xms is in InitialHeapSize. Filter your output (e.g. |grep on linux) or save it in a file so you can search in it.

2 of 5
51

Like you have mentioned, The default -Xmxsize (Maximum HeapSize) depends on your system configuration.

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

Which means if you have a physical memory of 8GB RAM, you will have Xmssize as Larger of 8*(1/64) and Smaller of -Xmxsizeas 8*(1/4).

You can Check your default HeapSize with

In Windows:

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

In Linux:

java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'

These default values can also be overrided to your desired amount.

🌐
GitHub
github.com › eclipse-openj9 › openj9 › issues › 1429
Adjust default max heap size when running in container · Issue #1429 · eclipse-openj9/openj9
March 13, 2018 - Current setting for max heap size for Java 9 are as follows: ... With 1/4th (in Java 9) or 512 MB (in Java 8) limit, JVM is clearly not utilizing memory that it as at its disposal.
Author   eclipse-openj9
🌐
Java67
java67.com › 2016 › 02 › how-to-increase-heap-size-of-java-program-eclipse-command-line.html
How to Increase Heap Size of Java Program running in Eclipse [Example] | Java67
It is possible to increase heap size allocated by the JVM in eclipse directly In eclipse IDE go to Run---->Run Configurations---->Chose the right application --->VM Arguments Enter -Xmx1G, to set the max size to 1GB.
Find elsewhere
🌐
Eclipse Foundation
eclipse.dev › openj9 › docs › xsoftmx
-Xsoftmx -
This function can be useful in ... specify the value in bytes, such as 2147483648 instead of 2g. For example, you might set the initial heap size to 1 GB and the maximum heap size to 8 GB....
🌐
Blogger
javarevisited.blogspot.com › 2016 › 10 › how-to-increase-heap-size-of-eclipse-OutOfMemoryError.html
How to increase heap size of Eclipse - Solving OutOfMemoryError? Example
May 17, 2023 - The second way to increase heap ... -vmargs -Xmx512m [more VM args] Now, the maximum Java heap space for eclipse is set to 512 megabytes....
🌐
Mkyong
mkyong.com › home › eclipse › eclipse – java.lang.outofmemoryerror: java heap space
Eclipse - java.lang.OutOfMemoryError: Java heap space - Mkyong.com
June 28, 2021 - But, if no reason constantly crashes the Eclipse IDE, we can increase the heap size and perm gen in eclipse.ini. /Users/mkyong/Downloads/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini · -startu openFile -showsplash //... -XX:MaxPermSize=512m -Xms512m -Xmx1024m //... -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread · P.S Find eclipse.ini in the Eclipse installation folder. Note The Java application, Ant / Maven build scripts, or unit test cases, are run as an external tool from Eclipse, and it does not inherit the VM settings in eclipse.ini.
🌐
Learn IT University
learn-it-university.com › home › an in-depth look into java 8: default max heap size exploration
An In-Depth Look into Java 8: Default Max Heap Size Exploration - Learn IT University
June 21, 2024 - The default maximum heap size (-Xmx) ... For the client VM, the default value is often set to 1/4th of your physical memory or 1GB, depending on which is smaller....
🌐
Stack Overflow
stackoverflow.com › questions › 18393972 › whats-the-default-jvm-heap-size-of-java-application-launched-by-eclipse
What's the default JVM heap size of Java application launched by eclipse - Stack Overflow
May 24, 2017 - If I don't set -Xmx of the Java application in eclipse. Eclipse will launch it with a default heap size which is related to the physical memory. I want to know how to compute this default value.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › technotes › guides › vm › gc-ergonomics.html
Garbage Collection Ergonomics
April 21, 2026 - Smaller of 1/4th of the physical memory or 1GB. Before Java SE 5.0, the default maximum heap size was 64MB.
🌐
DigitalOcean
digitalocean.com › community › tutorials › eclipse-out-of-memory-error-increasing-heap-memory-permgen-space
Eclipse OutOfMemory Error Fix by increasing Heap Memory/Permgen Space | DigitalOcean
August 4, 2022 - For example, below snippet will increase the eclipse heap size to 2 GB. ... If you are using below Java 8, then you might get OutOfMemoryError: Permgen space, just increase the permanent generation space available to Eclipse.
🌐
Coderanch
coderanch.com › t › 478404 › ide › increase-heap-size-eclipse
how to increase heap size with eclipse? (IDEs and Version Control forum at Coderanch)
Then when you get a OOME you will ... playing with several memory sizes i came to the conclusion 256 was enough for running from java: prompt> java -Xms256m -Xmx256m etc.....
🌐
W3Docs
w3docs.com › java
How is the default max Java heap size determined?
Since 1 GB is less than the maximum of 1 GB, the default maximum heap size would be set to 1 GB.