Configuring IntelliJ IDEA VM options

The 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:

Technorati tags: ,

This entry was posted in Tips & Tricks. Bookmark the permalink.

34 Responses to Configuring IntelliJ IDEA VM options

  1. Hassidi says:

    I saw in the 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?


  2. Alexandra Rusina says:

    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:

  3. Brad says:

    Have the recommendations changed in the past couple of years or are these still the recommended JVM settings with 7.0.3?

  4. I finally boosted my IDEA to great performance again, just by buying a SSD drive.
    My IDE(A) is fast again

    Happy coding


  5. 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.


  6. Pingback: On Boosting My IDE(A) – Jetbrains IntelliJ IDEA is fast again | Better Software Development

  7. Mohammad Kamran says:

    Is there any website having complete tutorial regarding idea.exe.vmoptions configuration for newbies in Java?

  8. Rob says:

    @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).

  9. Lato says:

    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

  10. Carl says:

    This tutorial is incomplete and outdated.

  11. jidea says:

    For any one wondering where you should do the changes, It is in
    JetBrainsIntelliJ IDEA binidea.exe.vmoptions file.

  12. Pingback: One Solution for IntelliJ IDEA Freezing « mikhail panchenko / blog

  13. Craig Motell says:

    “C:Program Files (x86)Javajdk1.6.0_21jrebinjava” -Xms128 -Xmx256 -Didea.launcher.port=7532 “-Didea.launcher.bin.path=C:Program Files (x86)JetBrainsIntelliJ IDEA Community Edition 10.0.2bin” -Dfile.encoding=windows-1250 -tetc…etcclasspath C:Program Files (x86)JetBrainsIntelliJ IDEA Community Edition 10.0.2libidea_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

  14. yole says:

    The correct syntax to use is -Xms128m rather than -Xms128. It looks like incorrect settings are specified in your run configuration settings.

  15. Ernst Bunders says:

    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:

    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.



  16. Damian Nowak says:

    > when your project contains more than 10000 classes

    How to check the number of classes in IDEA?

  17. Vathanak says:


    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) :


    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)



  18. Bjørn Chr says:

    “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..

  19. Val says:

    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.

  20. RobM says:

    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:
    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?

  21. RobM says:

    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:
    “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.

  22. RobM says:

    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

  23. David says:

    Nice article but not actual navigation paths posted to direct the user as to where to apply the posted values such as MaxPermSize. :-S

  24. Sireon says:

    “C:Program Files (x86)JetBrainsIntelliJ IDEA 10.5.4binidea.exe.vmoptions” if you use Windows 7.

    Make sure that you run the editor as administrator in order to be taken into account by IntelliJ Idea.

  25. Marc Jay says:

    This article is 6 years old now, and still top in google search results. How about a new article jetbrains! It’s 2012.

  26. Stefan Reich says:

    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%…

  27. Mohsen says:

    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?

  28. Michael Hasenstein says:

    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.

  29. Tony OHagan says:

    Here’s a more recent post from JetBrains … Note that it mentions where to the the 64 bit settings that this article is lacking.

  30. utkarsh says:

    so what should be the idle xms for intellij idea projects if i want it to run smoothly

  31. Marc says:

    Doesn’t work for me :/ Within a “large” project (it’s just TYPO3 and I can’t exclude all directories) the indexing process runs and runs and then I get the “increase memory..” window. I tried a lot of cases with Xmx and Xms, nothing works – and that I am paying for? I’m just looking for another IDE, PHPStorm seems to be not the best for me. This issue comes several times in different projects.

    16GB of RAM won’t fit on Ubuntu 64bit – i’m confused

  32. Shweta mantri says:

    I added this to -XX:ReservedCodeCacheSize=250m in idea.vmoptions to help->edit my vm options but now my IntelliJ does not open at all. I need to get rid of that line from the vmoptions, how do i do it without it opening.

Leave a Reply

Your email address will not be published. Required fields are marked *