I'm running a single project in PHPStorm on OSX - there's a fair amount of files as I have two other branches of my code in the project as well as the one I mostly work on. The file size of the 18,600 files in my project directory is 778 MB. I'm finding that PHPStorm gradually eats up more and more of my RAM, so I have to restart it at least once a day. On restart the memory consumption starts at about 200MB but steadily climbs up to about 360 and seems to stablise there. Something must be causing it to creep up more slowly through the day. Before restart my activity monitor was telling me it was using 915 MB, and PHPStorm status bar was reporting that it was using 140 MB of 791 MB.
Is there any setting I can use to keep the memory usage down, or any measures anybody can recommend? I guess you're going to say I should reduce the number of files in my project folder?
Actually it looks like PHPStorm mostly needs less memory than the virtual machine has allocated in the OS. You can try to reduce the Xmx value in idea.vmoptions (their location is described at http://stackoverflow.com/questions/13578062/how-to-increase-ide-memory-limit-in-intellij-idea-on-mac/13581526#13581526), I guess a value like 128m or 256m or anything in between should be sufficient for you. Note that this may cause PHPStorm to be slower and less responsive at times. If you feel that, just increase the Xmx value until you find a perfect one.
Uh sorry Peter, I'm looking for an original .vmoptions file to copy as recommended in the Stackoverflow post, but don't find a file like that anywhere on my system - I'm looking in /Applications/PhpStorm.app/bin, but don't see any options files there. Does this mean I need to create one?
Ah thanks, you mean these ones?
<string>-Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m</string>
<string>-Xms128m -Xmx800m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCompressedOops</string>
In case this is useful to anybody else - tweaking the memory settings is a bit of an art. Setting my xmx value to 150MB and XX:MaxPermSize 350MB (on 64 bit) brought my PhpStorm memory usage down to about 600MB. But now PhpStorm pops up this warning - so it seems to need that memory it was taking up before.
Not necessarily all, but apparently it needs more. You could capture another snapshot in these circumstances for us to find out what this memory is needed for. And you can just try a higher value.
This snapshot doesn't seem to be taken during high memory usage. You can enable -XX:+HeapDumpOnOutOfMemoryError as described at http://devnet.jetbrains.com/docs/DOC-192 and the next time PhpStorm runs out of memory there'll be an *.hprof file generated. We can look at it, too.