The original version of this document was here: http://tomaszdziurko.pl/2015/11/1-and-the-only-one-to-customize-intellij-idea-memory-settings/

I say "was" because it has been removed now, although there is a backup here: https://web.archive.org/web/20161125171758/http://tomaszdziurko.pl/2015/11/1-and-the-only-one-to-customize-intellij-idea-memory-settings/

In case the archived page ever disappears, I have copied the most important parts here:

What the original doesn't necessarily make clear is what file it is you need to change.  Basically search for idea.vmoptions which I believe you will find somewhere under /Applications/Initellij*.app/Contents/bin

Pasted document:

I have tested four different settings, to make reading easier each of them was given a name.

Default (grey)

These are built-in settings provided by JetBrains, clean IDEA 15 is using them:

1
2
3
4
5
-Xms128m
-Xmx750m

-XX:MaxPermSize=350m

-XX:ReservedCodeCacheSize=240m

-XX:+UseCompressedOops

Big (red)

4096MB for Xmx and 1024MB for ReservedCodeCacheSize, that’s quite a lot of memory.

1
2
3
4
-Xms1024m
-Xmx4096m

-XX:ReservedCodeCacheSize=1024m

-XX:+UseCompressedOops

Balanced (blue)

2GB for Xmx and 2GB for Xms, more balanced approach to the memory consumption

1
2
3
4
-Xms2g
-Xmx2g

-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops

Sophisticated (orange)

2GB for Xmx and 2GB for Xms as above, but different Garbage Collector is specified and many different flags for GC and memory management. I have received these settings from Yuri.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-server 
-Xms2g
-Xmx2g
-XX:NewRatio=3
-Xss16m
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
-XX:ReservedCodeCacheSize=240m
-XX:+AlwaysPreTouch
-XX:+TieredCompilation
-XX:+UseCompressedOops
-XX:SoftRefLRUPolicyMSPerMB=50
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-ea

So these are our test setups. To perform our test scenarios we have to create a file idea.vmoptions under ~/Library/Preferences/IntelliJIdea15/ (it is Mac OS specific, to see how change these settings for your OS, check this article).

Now it is time to perform our test scenarios and compare the results.