Tips & Tricks

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:
    -XX:+UseParallelGC
    -XX:+UseAdaptiveSizePolicy
    -XX:-UseConcMarkSweepGC

Technorati tags: Java, IDE
image description