By default, JetBrains products (IntelliJ, WebStorm, etc) products default to a very small minimum (128 MB) and maximum (750 MB) Java Heap Space:

➜  ps aux | grep -i webstorm 
..
nick     22103  383  2.7 6838044 901056 .. /usr/lib/jvm/default/bin/java -agentlib:yjpagent-linux64=disablealloc,delay=10000,sessionname=WebStorm2016.2 -Xbootclasspath/a:/opt/webstorm-eap/bin/../lib/boot.jar -classpath /opt/webstorm-eap/bin/../lib/bootstrap.jar:/opt/webstorm-eap/bin/../lib/extensions.jar:/opt/webstorm-eap/bin/../lib/util.jar:/opt/webstorm-eap/bin/../lib/jdom.jar:/opt/webstorm-eap/bin/../lib/log4j.jar:/opt/webstorm-eap/bin/../lib/trove4j.jar:/opt/webstorm-eap/bin/../lib/jna.jar -Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -XX:MaxJavaStackTraceDepth=-1 -Dawt.useSystemAAFontSettings=lcd -Djb.vmOptionsFile=/opt/webstorm-eap/bin/webstorm64.vmoptions -XX:ErrorFile=/home/nick/java_error_in_WEBIDE_%p.log -XX:HeapDumpPath=/home/nick/java_error_in_WEBIDE.hprof -Djb.restart.code=88 -Didea.paths.selector=WebStorm2016.2 -Didea.platform.prefix=WebStorm com.intellij.idea.Main
..

Depending on the amount of memory (RAM) available on one’s machine, it may be desirable to bump up these values by simply modifying the appropriate *vmargs file. This will depend on one’s installation directory, which will vary by operating system. For me, running sudo vim /opt/webstorm-eap/bin/webstorm64.vmoptions and updating my JVM args as reflected below

-Xms8g
-Xmx24g
-XX:ReservedCodeCacheSize=1024m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:MaxJavaStackTraceDepth=-1
-Dawt.useSystemAAFontSettings=lcd

My machine has 32 GB of RAM, so much higher values were appropriate. I also bumped up the value for ReservedCodeCacheSize which has a maximum allowed value of 1024m. I will need to re-start WebStorm after making this change to the webstorm64.vmoptions file, but I should now see these parameters reflected in the running webstorm process that I can check as shown above in the initial step.

Leave a Reply

Your email address will not be published. Required fields are marked *