PHPStorm chowing memory

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?

phpstorm-ram.gif

15 comments
Comment actions Permalink

Could you please take a memory dump? (click toolbar button at the right), upload it to ftp.intellij.net/.uploads and give ne the file name?

Thanks,
Kirill

0
Comment actions Permalink

Thanks Kirill, it's PS-117.746_user_13.02.2013_16.36.02.zip in .uploads.

0
Comment actions Permalink

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.

0
Comment actions Permalink

Thanks very much Peter, I'll try that.

0
Comment actions Permalink

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?

0
Comment actions Permalink

Sorry, didn't notice you have an older version. Please try Info.plist file in the PHPStorm application folder. It should contain Xmx inside some of the Java properties.

0
Comment actions Permalink

Ah thanks, you mean these ones?

      <key>VMOptions.i386</key>
      <string>-Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=64m</string>


      <key>VMOptions.x86_64</key>
      <string>-Xms128m -Xmx800m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCompressedOops</string>

0
Comment actions Permalink

Yes. Try changing Xmx parameter to something like -Xmx150m, not sure in which property. Perhaps in both to be sure.

0
Comment actions Permalink

Thanks for your help Peter - I'm on 64bit. Going to try 500MB for now and see how it goes.

0
Comment actions Permalink

Bah! I set 500MB, and today I find PHPStorm's still up at 930MB. Guess I need an even lower setting.

phpstorm-ram.gif

0
Comment actions Permalink

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.

phpstorm-memory-warning.gif

0
Comment actions Permalink

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.

0
Comment actions Permalink

Peter, I uploaded another snapshot, PS-117.746_user_21.02.2013_13.42.22.zip in .uploads, thanks. At Xmx 200 PHPStorm is currently on 473MB and seems happy enough.

0
Comment actions Permalink

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.

0
Comment actions Permalink

Clever! Cheers, will do.

0

Please sign in to leave a comment.