360

I'm using IDEA 12 Leda on Mountain Lion. I wanted to increase the maximum memory that IDE can use. I set the VMOptions in Info.plist file to be -Xmx2048m -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar

When I open up IDEA, I still see the maximum memory to be 711m.

jps -v shows my VMOptions has been loaded but it's replaced by the following options.

29388  **-Xmx2048m** -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar -Xms128m **-Xmx800m** -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCodeCacheFlushing -XX:+UseCompressedOops -Didea.paths.selector=IdeaIC12 -Dsun.java2d.noddraw=true -Didea.max.intellisense.filesize=2500 -Didea.dynamic.classpath=false -Didea.jars.nocopy=false -Dsun.java2d.d3d=false -Dapple.awt.fullscreencapturealldisplays=false -Dapple.laf.useScreenMenuBar=true -Djava.endorsed.dirs= -Dswing.bufferPerWindow=false -Didea.fatal.error.notification=enabled -Didea.cycle.buffer.size=1024 -Didea.popup.weight=heavy -Didea.xdebug.key=-Xdebug -Dapple.awt.graphics.UseQuartz=true -Dsun.java2d.pmoffscreen=false -Didea.no.launcher=false -DCVS_PASSFILE=~/.cvspass -Didea.use.default.antialiasing.in.editor=false -Dcom.apple.mrj.application.live-resize=false -Didea.smooth.progress=false
29392 Jps -Dapplication.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -Xms8m

Where does -Xmx800 come from? I need to remove it.

Mariusz Jamro
  • 30,615
  • 24
  • 120
  • 162
woodings
  • 7,503
  • 5
  • 34
  • 52
  • 4
    just note that for 64-bit the filename needs to be idea64.vmoptions – Ittai May 02 '13 at 12:10
  • @Ittai for me idea.vmoptions works for 64 bit as well on mac os 10.9 – Koray Tugay Jul 07 '14 at 10:13
  • On OS X 10.10.3 with IntelliJ 14, I had to rename `~/Library/Preferences/IdeaIC14/idea.vmoptions` to `idea64.vmoptions` before it would recognize the change, i.e., `-Xmx2048m`. –  Apr 24 '15 at 00:58
  • On OS X 10.11 Intellij 15 64-bit, I had to rename idea64.vmoptions to idea.vmoptions to make it work. – himanshu shekhar Feb 28 '19 at 18:14
  • See also IDEA options investigation at http://tomaszdziurko.com/2015/11/1-and-the-only-one-to-customize-intellij-idea-memory-settings – Grigory Kislin Apr 24 '19 at 11:38

13 Answers13

644

Current version: Help | Change Memory Settings:

Change memory settings

Since IntelliJ IDEA 15.0.4 you can also use: Help | Edit Custom VM Options...:

This will automatically create a copy of the .vmoptions file in the config folder and open a dialog to edit it.


Older versions:

IntelliJ IDEA 12 is a signed application, therefore changing options in Info.plist is no longer recommended, as the signature will not match and you will get issues depending on your system security settings (app will either not run, or firewall will complain on every start, or the app will not be able to use the system keystore to save passwords).

As a result of addressing IDEA-94050 a new way to supply JVM options was introduced in IDEA 12:

Now it can take VM options from ~/Library/Preferences/<appFolder>/idea.vmoptions and system properties from ~/Library/Preferences/<appFolder>/idea.properties.

For example, to use -Xmx2048m option you should copy the original .vmoptions file from /Applications/IntelliJ IDEA.app/bin/idea.vmoptions to ~/Library/Preferences/IntelliJIdea12/idea.vmoptions, then modify the -Xmx setting.

The final file should look like:

-Xms128m
-Xmx2048m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops

Copying the original file is important, as options are not added, they are replaced.

This way your custom options will be preserved between updates and application files will remain unmodified making signature checker happy.


Community Edition: ~/Library/Preferences/IdeaIC12/idea.vmoptions file is used instead.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • I cannot get this to work: settings in `~/Library/Preferences/IntelliJIdea12/idea.properties` seem not to be used. Did anyone have any luck with this? (also see: http://youtrack.jetbrains.com/issue/IDEA-99188) – praseodym Jan 19 '13 at 22:04
  • @praseodym : i put both the .properties and .vmoptions file in the .app/bin/ directory and it does work for me. This also true for windows. – Chii Jan 21 '13 at 03:17
  • @Chii, I had the same experience. Copying idea.vmoptions to ~/Library/Preferences/IntelliJIdea12/idea.vmoptions and changing properites there didn't do anything, but changing the file idea.vmoptions directly (/Applications/IntelliJ IDEA 12.app/bin/idea.vmoptions) worked. – Steni Jan 21 '13 at 09:25
  • 7
    this file worked for me: /Users//Library/Preferences/IdeaIC12/idea.vmoptions – PaulG Jan 21 '13 at 16:03
  • 1
    I want to put the _properties_ file outside the application bundle, because editing the `.app` bundle will cause its code signature to break and/or need redoing after every update. – praseodym Jan 21 '13 at 17:27
  • 1
    Neither /Applications ... nor ~/Library ... works for me (still trying) - I'm still on Snow Leopard, if it matters. – mparaz Feb 17 '13 at 12:18
  • My previous comment is on 12.0.3. It appears to now be working on 12.0.4, still on Snow Leopard. – mparaz Feb 18 '13 at 17:04
  • The one in `~/Library/Preferences//` should work, but there's a bug regarding the properties file, see [here](http://youtrack.jetbrains.com/issue/IDEA-100680). It's fixed in 12.1 now; not sure if the fix has been backported to 12.0.x. – TataBlack Mar 27 '13 at 14:13
  • 7
    On Mac OS X 10.8.3 and IntelliJ IDEA Ultimate 12.1.4 the correct command was ``$ cp -i /Applications/IntelliJ\ IDEA\ 12.app/bin/idea.vmoptions ~/Library/Preferences/IntelliJIdea12/``. This matches the latest IDEA configuration docs at http://www.jetbrains.com/idea/webhelp/increasing-memory-heap.html as mentioned by michael-m. – miguno Jul 10 '13 at 09:56
  • 6
    `cp /Applications/IntelliJ\ IDEA\ 13.app/bin/idea.vmoptions ~/Library/Preferences/IntelliJIdea13/idea.properties` and then `vi ~/Library/Preferences/IntelliJIdea13/idea.properties` – Darius Dec 09 '13 at 10:39
  • to all who say it doesn't work for them: how do you test it? try putting xmx of 1m in the idea.vmoptions file. Does your Idea start? (I kept looking at the Xmx flag of a Maven server process spawned from Idea, thinking this *is* Idea; it stayed at 512m, ofc; OSX 10.9.2) – Cpt. Senkfuss May 27 '14 at 20:43
  • 2
    If you are on OSX and using PHPStorm, you can copy it to ~/Library/Preferences/WebIde80/idea.properties (use WebIde70 if you are using phpstorm 7) – Mixologic Jun 01 '14 at 22:14
  • cp /Applications/IntelliJ\ IDEA\ 13.app/Contents/bin/idea.vmoptions ~/Library/Preferences/IntelliJIdea13/idea.properties – David Mann Jan 08 '15 at 18:57
  • In Webstorm 10, the `idea.vmoptions` file is now called `webstorm.vmoptions`. – Tyson Phalp Mar 31 '15 at 21:56
  • 1
    what about PHPStorm9? – Serge Velikan Jul 09 '15 at 10:49
  • 1
    In AppCode 3.2, `idea.vmnoptions` is now called `appcode.vmoptions` You can copy it to `~/Library/Preferences/AppCode32/appcode.vmoptions` (which also contains an `idea.vmnoptions` file) and it will work. You don't have to delete `idea.vmnoptions` – shmim Sep 08 '15 at 19:35
  • 1
    @serge-velikanov For PHPStorm9: `cp /Applications/PhpStorm.app/Contents/bin/idea.properties ~/Library/Preferences/WebIde90/idea.properties` – jacobfogg Sep 25 '15 at 17:12
  • Dear future me, please read the last line to know which folder to use! – Shubham Chaudhary Sep 26 '15 at 20:43
  • With IntelliJ Idea 15 you should use ~/Library/Preferences/IntelliJ IDEA15/idea.vmoptions as your file path. – Kimi Chiu Nov 27 '15 at 07:37
  • How can I verify that the configuration take effect ? I change the configuration, but seems not work. – zjffdu Dec 30 '15 at 07:13
  • 1
    It's no longer necessary to manually copy the file. You can now click "Help -> Edit Custom VM Options" and IDEA will create it for you. – Luna Mar 04 '16 at 11:54
  • Using Help | Edit Custom VM Options... did not work for me on MacOS Sierra. Instead I chose Edit configurations | VM options: -Xmx8000m – Peheje Feb 08 '17 at 22:06
  • I see on IntelliJ 2017.1 that the `idea.vmoptions` in IntelliJ have the options imported from 2016, but they aren't being used by the started application. – mkobit Mar 23 '17 at 21:02
  • Guys, 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**. – Dmytro Melnychuk May 29 '17 at 10:19
  • 1
    As a side note, make sure to restart your IDE, in order for changes to take place. – bullettrain Mar 12 '19 at 11:03
  • This certainly is the least pleasurable part of "developing with pleasure" :-( – Kedar Mhaswade May 21 '19 at 01:45
120

[Updated Aug 2021 since the JetBrains UI has changed]

Helpful trick I thought I'd share on this old thread.

You can see how much memory is being used and adjust things accordingly using the Memory Indicator

Right click in the bottom most taskbar area and select the Memory Indicator item

How to enable Memory Indicator by right clicking

It shows up in the lower right of the window.

enter image description here

TrophyGeek
  • 5,902
  • 2
  • 36
  • 33
14

For IDEA 13 and OS X 10.9 Mavericks, the correct paths are:

Original: /Applications/IntelliJ IDEA 13.app/Contents/bin/idea.vmoptions

Copy to: ~/Library/Preferences/IntelliJIdea13/idea.vmoptions

ujay68
  • 390
  • 4
  • 11
11

Here is a link to the latest documentation as of today http://www.jetbrains.com/idea/webhelp/increasing-memory-heap.html

Michael M
  • 8,185
  • 2
  • 35
  • 51
  • That is only about increasing the heap for the compiler, not for the IDE. – Zayenz Sep 09 '13 at 14:29
  • 3
    @Zayenz :: False. It's not "only" about increasing the heap for the build process, but it also includes information to answer the question - i.e. Under the "Notes" it says.... `The memory heap available to IntelliJ IDEA may be changed by editing the corresponding VM options. Depending on the platform, these files are:....`. - TLDR for you? – Michael M Sep 09 '13 at 19:33
  • 1
    @michael-m Sorry. I did read, but somehow missed that note. Thanks for correcting me. – Zayenz Sep 10 '13 at 06:41
6

go to that path "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\bin\idea.exe.vmoptions" and change size to -Xmx512m

  -Xms128m
  -Xmx512m
  -XX:MaxPermSize=250m
  -XX:ReservedCodeCacheSize=64m
  -XX:+UseCodeCacheFlushing
  -ea
  -Dsun.io.useCanonCaches=false
  -Djava.net.preferIPv4Stack=true

hope its will work

Rinkesh
  • 3,150
  • 28
  • 32
6

As for the intellij2018 version I am using the following configuration for better performance

-server
-Xms1024m
-Xmx4096m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=512m
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:CMSIncrementalDutyCycleMin=0
-XX:-TraceClassUnloading
-XX:+TieredCompilation
-XX:SoftRefLRUPolicyMSPerMB=100
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Xverify:none

-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof
Avishek Bhattacharya
  • 6,534
  • 3
  • 34
  • 53
6

More recent versions of IntelliJ (certainly WebStorm and PhpStorm) have made this change even easier by adding a Help >> Change Memory Settings menu item that opens a dialog where the memory limit can be set.

menu item to show memory limit setting memory setting dialog

BeetleJuice
  • 39,516
  • 19
  • 105
  • 165
3

OSX 10.9, if you dont bother about signed application you might just change

/Applications/IntelliJ\ IDEA\ 12\ CE.app/bin/idea.vmoptions
Arneball
  • 359
  • 3
  • 10
2

On my machine this only works in bin/idea.vmoptions, adding the setting in ~/Library/Preferences/IntelliJIdea12/idea.vmoptions causes the IDEA to hang during startup.

ajtrichards
  • 29,723
  • 13
  • 94
  • 101
Zack
  • 21
  • 1
  • Please see my updated answer. Note that `idea.vmoptions` in the `Preferences` doesn't add options, it replaces them. Therefore you need to copy the original file from the `bin` directory and then modify it. – CrazyCoder Nov 29 '12 at 10:23
2

It looks like IDEA solves this for you (like everything else). When loading a large project and letting it thrash, it will open a dialog to up the memory settings. Entering 2048 for Xmx and clicking "Shutdown", then restarting IDEA makes IDEA start up with more memory. This seems to work well for Mac OS, though it never seems to persist for me on Windows (not sure about IDEA 12).

Michael Bushe
  • 1,503
  • 16
  • 16
2

Some addition to the top answer here https://stackoverflow.com/posts/13581526/revisions

  1. Change memory as you wish in .vmoptions
  2. Enable memory view as told here https://stackoverflow.com/a/39563251/5515861

And you'll have something like this in the bottom right

enter image description here

abmap
  • 141
  • 5
2

I edited the config file from the editor and on the next reboot IntelliJ would not open even after updating to the newest version. After opening IntelliJ manually using /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea in terminal the output gave me additional insight on where the .vmoptions copy is stored.

➜  ~ /Applications/IntelliJ\ IDEA.app/Contents/MacOS/idea
2022-04-21 13:01:55.189 idea[1288:14841] allVms required 1.8*,1.8+
2022-04-21 13:01:55.192 idea[1288:14845] Current Directory: /Users/richardmiles
2022-04-21 13:01:55.192 idea[1288:14845] parseVMOptions: IDEA_VM_OPTIONS = (null)
2022-04-21 13:01:55.192 idea[1288:14845] fullFileName is: /Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions
2022-04-21 13:01:55.192 idea[1288:14845] fullFileName exists: /Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions
2022-04-21 13:01:55.192 idea[1288:14845] parseVMOptions: /Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions
2022-04-21 13:01:55.192 idea[1288:14845] parseVMOptions: /Applications/IntelliJ IDEA.app.vmoptions
2022-04-21 13:01:55.195 idea[1288:14845] parseVMOptions: /Users/richardmiles/Library/Application Support/JetBrains/IntelliJIdea2022.1/idea.vmoptions
2022-04-21 13:01:55.195 idea[1288:14845] parseVMOptions: platform=17 user=1 file=/Users/richardmiles/Library/Application Support/JetBrains/IntelliJIdea2022.1/idea.vmoptions
Invalid maximum heap size: -Xmx2048m -Drun.processes.with.pty=true
Invalid maximum heap size: -Xmx2048m -Drun.processes.with.pty=true
2022-04-21 13:01:55.266 idea[1288:14845] JNI_CreateJavaVM (/Applications/IntelliJ IDEA.app/Contents/jbr) failed: -6

Note when you work with the path remember to quote properly like so!

vim "/Users/richardmiles/Library/Application Support/JetBrains/IntelliJIdea2022.1/idea.vmoptions"
0

I use Mac and Idea 14.1.7. Found idea.vmoptions file here: /Applications/IntelliJ IDEA 14.app/Contents/bin

details

Denys
  • 1,308
  • 12
  • 13