I'm a beginner in Java, and I just started using Intellij as my IDE.
When I use it, sometimes it's delayed.
I changed my xms and xmx for larger heap size (xms = 1024, xmx = 2048), but it throws an error.
So, I rolled it back.
The error message was something like this: "Initial heap size set to a larger value than the maximum heap size".
What is the problem?
If possible, how do I increase maximum heap size?
I'm using a laptop and it has 8GB memory. x64 Intellij.exe used.
To get rid of this error, the value of Xmx(maximum heap size) should always be greater than or equal to Xms(minimum heap size). Run the HelloWorld program with the value of Xms(minimum heap size) set to 1 gigabyte and Xmx(maximum heap size) set to 2 gigabytes.
Open the Toolbox App, click the settings icon next to the relevant IDE instance, and select Settings. On the instance settings tab, expand Configuration and specify the heap size in the Maximum heap size field.
Initial heap size is 1/64th of the computer's physical memory or reasonable minimum based on platform (whichever is larger) by default. The initial heap size can be overridden using -Xms. Maximum heap size is 1/4th of the computer's physical memory or 1 GB (whichever is smaller) by default.
Limits the maximum memory heap size that the JVM can allocate for running IntelliJ IDEA. The default value depends on the platform. If you are experiencing slowdowns, you may want to increase this value, for example, to set the value to 2048 megabytes, change this option to -Xmx2048m .
If you are seeing this error in InteliJ after the 2019.2 update it is because the update changed the JVM XMX value to 2048m without checking the related values which can allow XMS to become larger than the max XMX value which is not valid and creates that error.
i.e. The values for me had been XMX=6000m and XMS=4096m but after the 2019.2 update they were XMX=2048m and XMS=4096m
You will have to manually change the values so XMS is equal to or less than XMX. On Macs the VM options file is ~/Library/Preferences/IntelliJIdea2019.2/idea.vmoptions
NOTE: That path assumes you are on InteliJ version 2019.2. You will need to change that value in the path to the version you are on if
I had the same issue on Linux. The configuration file is found in
~/.IntelliJIdea2018.2/config/idea64.vmoptions
The directory will look like ~/.IntelliJIdeayyyy.n/config where yyyy is the year, and n is the release number in that year.
Make sure that the
-Xms
value is higher than the -Xmx
Here is my working config for ubuntu 18.04 with 8GB RAM
# custom IntelliJ IDEA VM options
-server
-Xms4096m
-Xmx4096m
-XX:NewSize=1024m
-XX:MaxNewSize=1512m
-XX:NewRatio=1
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
-XX:SurvivorRatio=8
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:+CMSParallelRemarkEnabled
-XX:CMSInitiatingOccupancyFraction=65
-XX:+CMSScavengeBeforeRemark
-XX:+UseCMSInitiatingOccupancyOnly
-XX:ReservedCodeCacheSize=64m
-XX:-TraceClassUnloading
-ea
-Dsun.io.useCanonCaches=false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With