You can increase to 2GB on a 32 bit system. If you're on a 64 bit system you can go higher. No need to worry if you've chosen incorrectly, if you ask for 5g on a 32 bit system java will complain about an invalid value and quit.

As others have posted, use the cmd-line flags - e.g.

java -Xmx6g myprogram

You can get a full list (or a nearly full list, anyway) by typing java -X.

Answer from Steve B. on Stack Overflow
🌐
Oracle
docs.oracle.com › cd › E19159-01 › 819-3681 › abeii › index.html
Tuning the Java Heap (Sun Java System Application Server 9.1 Performance Tuning Guide)
By default, the JVM grows or shrinks ... range. This range is set as a percentage by the parameters -XX:MinHeapFreeRatio=minimum and -XX:MaxHeapFreeRatio=maximum; and the total size bounded by -Xms and -Xmx....
Discussions

macos - How to I change the default JVM heap size on OS X? - Ask Different
I am looking for a way to change the default JVM memory settings on OS X, not for a specific application. And, yes I know that each application can override this. ... Go to Applications / Utilities and open the Java Preferences. Select the Java version you're interested in. Hit Options and add the Heap size ... More on apple.stackexchange.com
🌐 apple.stackexchange.com
September 7, 2012
How to increase java' heap size, whatever that is
The Java Virtual Machine (JVM) reserves some amount of memory at startup. This memory is called the heap and is used for objects during runtime. If the JVM doesn't have enough heap memory programs will start throwing OutOfMemoryExceptions and usually crash. You can configure the JVM to reserve more memory at startup with some flags: -Xms256m: This tells the JVM to reserve a minimum of 256 megabytes at startup. If you want to reserve more just increase the amount. 1024m is 1 gigabyte. 2014 is 2 gigabytes. -Xmx1024m: This tells the JVM to not use more than 1024 megabytes during runtime. If your program tries to use more memory then you'll get the OutOfMemoryExceptions explained above. The error you are seeing is likely because -Xms is being set to a larger value than -Xmx. It doesn't make any sense to request more minimum memory than the maximum you've specified, right? I suggest making the values of -Xms and -Xmx the same. More on reddit.com
🌐 r/javahelp
17
3
December 29, 2017
Teku best setting for max Java Heap Size
The team recommends 5 as a minimum. Since you have plenty of RAM you can give it 8, same as Besu. Anything beyond that is redundant, I believe. More on reddit.com
🌐 r/ethstaker
10
9
April 28, 2023
Why is my server out of memory (before it even starts)?
Are you using 64 bit java? More on reddit.com
🌐 r/feedthebeast
21
2
January 14, 2015
🌐
Reddit
reddit.com › r/javahelp › how to increase java' heap size, whatever that is
r/javahelp on Reddit: How to increase java' heap size, whatever that is
December 29, 2017 -

(FIXED)

Firstly, explainlikeiamfive since i understand nothing about java whatsoever, but the point is, when configiring a game to allocate more memory, that was around 230m at the point, went to the suport page and found how to allocate more memory, but then java error message said that the initial heap size was set to a larger value than the max heap size

🌐
IBM
ibm.com › docs › hu › db2-data-mgr-console › 3.1.x
Configuring java heap size
The Java Virtual Manager (JVM) requires a certain amount of memory to monitor databases. The memory allocated to JVM depends on the monitoring profile settings and the number of databases being monitored. If you are monitoring large number of databases, it is recommended to increase the initial (Xms) and maximum (Xmx) heap size values to prevent out of memory errors.
🌐
Stanford
protegewiki.stanford.edu › wiki › Setting_Heap_Size
Setting Heap Size - Protege Wiki
February 17, 2022 - (or, if on Windows, run.bat). You may change the heap size by editing the run script in a text editor, and change the value of the -Xmx argument. For example, to start with a 500MB heap size, use -Xmx500M. Read more on setting the heap size as an argument for generic Java applications here and here.
Find elsewhere
🌐
Baeldung
baeldung.com › home › spring › spring boot › configure the heap size when starting a spring boot application
Configure the Heap Size When Starting a Spring Boot Application | Baeldung
May 29, 2025 - Then, we’ll use Maven first to configure the heap size when starting the application using mvn on the command-line. We’ll also look at how we can set those values using the Maven plugin. Next, we’ll package our application into a jar file and run it with JVM parameters provided to the java ...
🌐
Sematext
sematext.com › home › glossary › glossary › jvm heap
What Is Java Heap Memory? - Sematext
January 16, 2025 - The heap size is specified using command-line options when launching a Java application. The two commonly used options are: ... If the initial heap size is too small, the JVM may need to resize the heap frequently, resulting in performance overhead ...
🌐
Java67
java67.com › 2020 › 09 › how-to-increasing-heap-size-in-java.html
How to Increasing Heap Size of Java application in JVM? Example Tutorial | Java67
$ java -Xmx6g myprogram You can get a full list (or a nearly full list, anyway) by typing java -X. It is possible to increase the heap size allocated by the JVM by using command-line options Here we have 3 options -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size For example
🌐
Atlassian Support
support.atlassian.com › bitbucket-data-center › kb › set-heap-size-for-java-on-bitbucket-server-and-data-center
Set heap size for Java on Bitbucket Server and Data Center | Bitbucket Data Center | Atlassian Support
April 2, 2025 - Sometimes, you might need to change JVM parameters for heap size on Bitbucket (Xms and Xmx). To do this, edit the files and restart Bitbucket to apply the changes. Applies to Bitbucket on-premise installations on Windows and Linux environments. ... Through the command line, go to the Bitbucket binary folder: cd <Bitbucket Server installation directory>\bin. Access the Bitbucket process: bservmgr.exe //ES//AtlassianBitbucket. In the pop-up window, select the Java tab and edit the Initial Memory Pool and Maximum Memory Pool values.
🌐
Tencent Cloud
tencentcloud.com › techpedia › 108821
How to set the Java heap size? - Tencent Cloud
To set the Java heap size, you can use JVM (Java Virtual Machine) command-line options. The heap size is the amount of memory allocated for the Java application to run. You can set both the initial an...
🌐
TestArchitect
docs.testarchitect.com › administration-guide › repository-server-management › setting-java-heap-size
TestArchitect Docs - Setting Java heap size
If Java heap memory is set too low, TestArchitect may not have enough memory to perform normal operations. Set the Java heap size at a level that is large enough to enable TestArchitect to function properly, but not so large that the amount of physical memory available to other applications is affected.
🌐
Alvin Alexander
alvinalexander.com › blog › post › java › java-xmx-xms-memory-heap-size-control
How to control Java heap size (memory) allocation (xmx, xms) | alvinalexander.com
January 31, 2026 - The default value is 640K. (The -server flag increases the default size to 2M.) -Xmx size in bytes Sets the maximum size to which the Java heap can grow. The default size is 64M.
🌐
Medium
medium.com › @maheshwar.ramkrushna › understanding-heap-size-and-its-impact-on-java-application-performance-d4c312bbd13c
Understanding Heap Size and its Impact on Java Application Performance | by Ramkrushna Maheshwar | Medium
May 25, 2023 - The JVM heap is where objects created by a Java program are stored during runtime. By default, the initial heap size of a Java application is set to 1/64th of the computer’s physical memory or a reasonable minimum based on the platform, whichever value is larger.
🌐
IBM
ibm.com › docs › en › devops-release › 6.2.5
Increasing Java memory limits
Increase the memory allocation pool for the Tomcat server.
🌐
Boomi
community.boomi.com › s › article › How-to-increase-Java-heap-size
Article: How to increase Java heap size - Boomi Community
The easiest way to do this is to increase the java heap size on your basic runtime. This setting is found in the GUI under Runtime Management in your basic runtime properties as seen in the screenshot below. In the above screenshot the heap size is set to 1024m this means its set to 1024 MB.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-increase-heap-size-in-java-virtual-machine
How to Increase Heap Size in Java Virtual Machine? - GeeksforGeeks
July 23, 2025 - So a common solution to it Now in order to change/increase the JVM heap size is made possible by using command-line options. -Xms : To set an initial java heap size -Xmx : To set maximum java heap size -Xss : To set the Java thread stack size -Xmn : For setting the size of young generation, rest of the space goes for old generation