Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm/Webstorm increase memory to more than 512MB

I'm using PHPStorm under Win7 64bit with 64bit Java (latest version I guess) and working currently on an insanely big and chaotic project. There are many classes containing 10k LOC and more. Therefore my PHPStorm runs out of memory once in a while.

I get this nice Out-of-Memory dialog suggesting increasing my memory settings. I currently have set in my PhpStorm.exe.vmoptions:

-server -Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+UseCodeCacheFlushing -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 

The problem is: When I increase my memory to be used in this file I get the following error when starting the program:

Failed to create JVM: Error code -4

I Googled around but nobody seems to want the memory to be more than 512MB.

Does anybody know what I can do to use PHPStorm without any hassle again?

Sure, I can reset the cache but this is not a permanent solution, right?

I read somewhere that adding this line to my vmoptions is a good idea, but I don't see any difference:

-server .... -XX:MinHeapFreeRatio=15 
like image 209
Ron Avatar asked Aug 28 '14 10:08

Ron


People also ask

How do I increase memory size in WebStorm?

Increase the memory heapFrom the main menu, select Help | Change Memory Settings. In the Memory settings dialog that opens, set the necessary amount of memory that you want to allocate and click Save and Restart. This changes the value of the -Xmx option used by the JVM and restarts WebStorm with the new setting.

How do I give Phpstorm more memory?

Increase the memory heap of the IDEFrom the main menu, select Help | Change Memory Settings. Set the necessary amount of memory that you want to allocate and click Save and Restart.

How do I increase allocated heap size in IntelliJ?

Open the Toolbox App, click the settings icon next to the relevant IDE instance, and select Settings. On the instance settings tab, expand Configuration and specify the heap size in the Maximum heap size field.


2 Answers

Changing memory settings for PHPStorm now has a menu option:enter image description here

like image 111
Ernestas Stankevičius Avatar answered Sep 23 '22 05:09

Ernestas Stankevičius


Make sure that PhpStorm use 64-bit Java and not bundled one (which is 32-bit). You an check that in Help | About.

Generally speaking: with 64-bit Java you do not have to change that value as it works a bit differently compared to 32-bit one.

1) PhpStorm comes with bundled x86 Java and it is the first one that it tries; only then it looks for other Java installations -- check PhpStorm.bat for details (what environment variables and in which order). By defining one of those environment variables (which will point to your 64-bit Java installation) you can tell PhpStorm to use instead of bundled one.

2) PhpStorm v8 (currently in EAP stage) comes with 64-bit specific files: you should use PhpStorm64.exe and not PhpStorm.exe (same for .vmoptions file -- it should be PhpStorm64.exe.vmoptions).

I'm not sure how PhpStorm v7 works with 64-bit Java -- have never tried it this way myself.


Selecting the JDK version the IDE will run under

https://intellij-support.jetbrains.com/entries/23455956-Selecting-the-JDK-version-the-IDE-will-run-under

like image 22
LazyOne Avatar answered Sep 23 '22 05:09

LazyOne