'How to increase IDE memory limit in IntelliJ IDEA on Mac?

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.



Solution 1:[1]

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.

Solution 2:[2]

[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

Solution 3:[3]

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

Solution 4:[4]

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

Solution 5:[5]

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

Solution 6:[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

Solution 7:[7]

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

Solution 8:[8]

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

/Applications/IntelliJ\ IDEA\ 12\ CE.app/bin/idea.vmoptions

Solution 9:[9]

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.

Solution 10:[10]

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

Solution 11:[11]

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

Solution 12:[12]

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

details

Solution 13:[13]

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"