The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could block the execution. The way how memory manager works. JVM needs to allocate memory for Java application (PhpStorm in our case) in single solid block (IIRC). Any libraries that inject themself into process memory will reduce such solid block. Make sure Override console cycle buffer size (1024 KB) checkbox is checked Finally, increase the default value of 1024 KB. You could set it to 4096 KB that is 4 times the default. Also, increase build process heap size: if you use IntelliJ IDEA 2020.3 or newer, set 'User-local build process heap size' to 2048. If you use IntelliJ IDEA 2020.2 or older, copy value from 'Shared build process VM options' to 'User-local build process VM options' and add -Xmx2G to it. These changes will greatly reduce compilation time. The way to fix it is to add or change the heap size setting. From the main menu, choose Help Edit Custom VM Options to create a copy of the idea.vmoptions file in the user home directory. See PhpStorm's help page for more information.
Tips & TricksThe 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