Configuring IntelliJ IDEA VM options
April 21st, 2006 by Alexandra RusinaThe default VM options for IntelliJ IDEA may be not optimal when your project contains more than 10000 classes and developers often try to change the default options to minimize IntelliJ IDEA hangtime. But sometimes the changes make things even worse.
So, how to configure IntelliJ IDEA VM options optimally? That’s not so easy question to answer, since the configuration strongly depends on the project being developed.
However, it is a well-known fact that JetBrains “eats its own dog food” and uses IntelliJ IDEA for development of new IntelliJ IDEA versions. Therefore, we can recommend some settings that our developers use and explain the general memory policy.
1. -Xms = 32m (64m)
2. -Xmx = 256m
Please note that very big Xmx and Xms values are not so good. In this case, GarbageCollector has to work with a big part of memory at a time and causes considerable hang-ups. On the other hand, too small values can lead to the OutOfMemory exception. The specified values provide enough memory and at the same time the GarbageCollector works often but rather fast.
One more important thing is to pay attention to the memory indicator at the bottom-right corner of IntelliJ IDEA. If it shows that the memory in use is almost equal to the total memory available (let’s say 195m out of 220m), we recommend you to increase Xmx on 50m or so.
3. -XX:MaxPermSize=92m
This is a default value, and in most cases you don’t need to change it. You may increase it only if you get “OutOfMemoryError” in “PermGen space”.
4. -server
Some people find IntelliJ IDEA more responsive with this option. But it is not guaranteed.
5. We don’t recommend to use the following options at all, since they are not very stable:
-XX:+UseParallelGC
-XX:+UseAdaptiveSizePolicy
-XX:-UseConcMarkSweepGC

May 31st, 2006 at 2:31 am
I saw in the intellij.net website forum the followed: “-Dsun.awt.keepWorkingSetOnMinimize=true”.
Is it safe? Is it usefull?
I didn’t see it in your “not to use” parameters?
Thanks.
May 31st, 2006 at 7:57 am
We don’t configure this option for IntelliJ IDEA. So, I can’t say whether it is actually useful or not.
Probably, this link may help you somehow:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5043070
July 18th, 2008 at 1:06 pm
Have the recommendations changed in the past couple of years or are these still the recommended JVM settings with 7.0.3?
August 6th, 2008 at 8:06 pm
I finally boosted my IDEA to great performance again, just by buying a SSD drive.
See:
My IDE(A) is fast again
Happy coding
Michael
February 1st, 2010 at 1:02 pm
Look, you haven’t mentioned that where do we have to do all of these changes.. why are you always missing basics and very simple stuff.. new Idea user will probably get lost with these instructions..
You have to edit the idea.vmoptions file with those mentioned parameters.
Lahiru
March 6th, 2010 at 6:02 pm
[...] There were several articles talking about IDEA optimizations. Mostly settings and JVM startup params. 10 Tips by Hamlet d’Arcy IDEA Performance Tuning by J2EE blogger IDEA VM options from the JetBrains blog [...]
March 16th, 2010 at 2:11 am
Is there any website having complete tutorial regarding idea.exe.vmoptions configuration for newbies in Java?
July 30th, 2010 at 5:43 am
@Mohammad - I find intellij to be pretty good out of the box these days (version 9). I’ve just reinstalled on a new machine and have set -server and -da out of habit, but it was working fine before I did that. The heap size settings were already sufficient for my needs (512m).
August 6th, 2010 at 7:17 am
1. -Xms = 32m (64m)
2. -Xmx = 256m
The definition above is confusing. Using these parameters in your vm, you have to define them like:
-Xms64m -Xmx256m
September 7th, 2010 at 9:51 am
This tutorial is incomplete and outdated.
September 8th, 2010 at 4:03 am
For any one wondering where you should do the changes, It is in
\JetBrains\IntelliJ IDEA \bin\idea.exe.vmoptions file.
October 8th, 2010 at 5:05 pm
[...] codebase, so 1GB suits us well. IntelliJ’s developers stated essentially the opposite here a few years back, but my experience does not correspond with their predictions. I’m guessing [...]
March 26th, 2011 at 3:19 pm
“C:\Program Files (x86)\Java\jdk1.6.0_21\jre\bin\java” -Xms128 -Xmx256 -Didea.launcher.port=7532 “-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 10.0.2\bin” -Dfile.encoding=windows-1250 -tetc…etcclasspath C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 10.0.2\lib\idea_rt.jar” com.intellij.rt.execution.application.AppMain
Error occurred during initialization of VM
Too small initial heap
I have tweaked heap space in three locations:
1) edit configuration (for my project) with VM parameters -Xms128m - Xmx256m and/or -Xms256m -Xmx512m
2) settings (put maximum heap size 1024M)
3) idea.exe.vmoptions (from 64m to 1024m) now at -Xms128m - Xms1012m
When I run my program, the console shows only the vmopitons settings.
But I’m still running out of heap space at the very start.
Also when I run IntelliJ It tells me that I have memory left.
Can you tell me if there is anything else I can try? And how the three settings relate?
thank you
March 28th, 2011 at 6:09 am
Craig,
The correct syntax to use is -Xms128m rather than -Xms128. It looks like incorrect settings are specified in your run configuration settings.
July 27th, 2011 at 8:48 am
There is a related issue to idea memory settings, that I would love to get an answer to. It is becomming slightly vexing to me.
My vmsettings options are:
-Xms128m
-Xmx700m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
And when I look at the lower right, idea tells me it’s using ‘159M of 620M’
That would be nice, right?
But my os process manager tells me a different story: 1.5GiB WTF!!!
I am developing on a 4GiB machine, and usually my memory is full, thanks to idea. I don’t get this, and the weird thing is noone else seems to be troubled by this, i can’t find any comments about it.
I am currently using ubuntu 11.4 and idea-IU-107.105, but the problem was there from the start, about a year ago.
It’s not impossible to work, but is sure is annoying. If anything could be done, or if at least i could understand why this happens, I would be glad.
regards,
Ernst
September 15th, 2011 at 9:14 am
> when your project contains more than 10000 classes
How to check the number of classes in IDEA?
September 18th, 2011 at 10:45 am
Hi,
A blog said (I forget it) that if you increase the MaxPermSize over 500m, there may be the memory problem because garbage collector might take forever to do its task. I don’t know it’s true or not. If it’s true, can you decrease it to 500m or can you try to set the maximum garbage collector pause to (in the file idea.vmoptions) :
-XX:MaxGCPauseMillis=10
That means that java’s GC will take max 10ms to do his work.
And use concurrent Mark-Sweep (CMS) Collector (But i’m not sure that this will help for latest version of IDEA)
-XX:+UseConcMarkSweepGC
Reference: http://stackoverflow.com/questions/4676604/how-to-improve-intellij-code-editor-speed
September 27th, 2011 at 5:56 am
“However, it is a well-known fact that JetBrains “eats its own dog food” and uses IntelliJ IDEA for development of new IntelliJ IDEA versions.”
Sounds like it could often become terrible confusing..
October 14th, 2011 at 6:01 pm
I used version 9.0.3 on my old XP
Now I upgraded my machine with dual CPU and 3.16 GB
And IntelliJ 10.5.2
Previously I used -Xms128m -Xmx2048m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m
It was pretty slow. Memory consumed by Idea process was over 1gb
Now I cannot run idea 10 with setting -Xmx2048m . It returns “too large” error.
I changed to -Xmx1024m, but it is working extremely slow - number of hours to load a project.
Please, advice.
Thanks.
October 24th, 2011 at 7:00 pm
This is some sort of slow-death torture.
Idea 10.5.2 on Vista Business SP2. Administrator account and a personal account with administrator privs.
The file and folder declined editing from my personal (with Administrator privs) account. But both say that “effective privileges” mean it’s editable. Finally turned off User Account Control and it permitted me to edit and save the file in place, but on changing back to my user account the file has reverted to some default setting:
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-ea
Interesting to see that I can’t see line breaks in that string in the file in notepad, but pasted into here it breaks the lines? Nix line breaks in a windows config file???
What a mess. Why are there so many magic doors to open to set these?
November 1st, 2011 at 1:49 am
Seems fixed now thanks to:
http://www.pauldeden.com/2011/06/how-to-fix-permgen-memory-error-in.html
November 2nd, 2011 at 12:24 am
This is the monkeyscript for the fix I’m using successfully in Intellij 10.5.2:
From the intellij menu:
“Run” - “Edit Configurations” -
Expand “Grails” - “Grails:[projectname]” - “Grails” tab
In the “VM Parameters” textbox, set the following:
-XX:MaxPermSize=256M
“Apply” and Ok your way out.
That line was blank when I started. If it has something in it already you may need to discover what the correct delimiter is to add this bit. BTW, that line was cut and paste from my working intellij, so it should be right.
December 12th, 2011 at 8:56 pm
This is the line currently in that config box (mentioned above) after some months of use and tweaking:
-XX:MaxPermSize=128m -XX:PermSize=128m -Xms1024m -Xmx1024m -XX:-UseGCOverheadLimit
January 13th, 2012 at 12:54 pm
Nice article but not actual navigation paths posted to direct the user as to where to apply the posted values such as MaxPermSize. :-S
March 7th, 2012 at 2:59 pm
“C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.5.4\bin\idea.exe.vmoptions” if you use Windows 7.
Hint:
Make sure that you run the editor as administrator in order to be taken into account by IntelliJ Idea.
June 22nd, 2012 at 6:19 pm
This article is 6 years old now, and still top in google search results. How about a new article jetbrains! It’s 2012.
October 13th, 2012 at 8:21 am
Hi all! I recommend this option for IntelliJ 11 in idea.exe.vmoptions: -XX:MinHeapFreeRatio=15
This reduces memory usage drastically which leads to less swapping. The option means that only 15% of IntelliJ’s heap will be unused, not 40% as per default. I’m not seeing noticeable performance decreases by this.
You could even go down to 10%…
November 21st, 2012 at 3:39 am
I can’t increase my intellij xmx more than 900 MiB.
While I’m using 32 bit windows with 4GiB of RAM.
How can I increase xmx to 2GiB?
December 8th, 2012 at 6:11 am
About complaints about the age of this article: It does not really matter, those options are generic Java runtime options. Nothing here is specific to Webstorm, which means you can leave out “webstorm” out of your Google searches for this topic and instead focus on “java”. You’ll find TONS of articles and forum posts regarding JRE parameters like Xms, Xmx, etc.