Quick tip: increase PhpStorm memory limit

I use PhpStorm as my standard IDE in work. Why? I think it isn’t necessary to describe all advantages – it’s very good software, appreciated and recommended by many, many developers from whole world. PhpStorm can increase our productivity, we can work very fast with code inspection, integrated version control, debugging, testing and many, many other things. But PhpStorm is not perfect. It can be slow if we work with bad or low quality code – mix of not only PHP but also HTML, CSS and JavaScript in one file. With active default inspections and a lot of lines, it can be slooow and require more memory.

The best solution: write good code, separate views, models, view logic etc. from each other. But… sometimes it’s easy to say, but difficult to do. Any legacy projects, old code or project which just need “refactoring”. What can we do in such situations? First option is to enable power saving mode – it disables inspectors, a lot of PhpStorm functionality, but make this IDE much, much faster and independent of the complexity of the file. We can also use something else, other application such super fast Sublime. But I don’t like changing apps during work. If CPU is not a problem, we can still have some issues with default, small memory limit in PhpStorm.

You can see current memory usage in memory indicator, displayed on bottom right on default settings. If you click this indicator, PhpStorm will try to free some memory. It can help, but if you work with complex files, only for few minutes (of seconds). If you have a lot of memory and can use some for IDE, try increase PhpStorm limit. You will not find this in settings – I don’t know why, but you must edit VM options. manually. Select Help and then “Edit Custom VM Options”. There should be few lines, you should edit (or just) only one:

This 2048m is of course new memory limit – 2 GB in this case. You can use other value, but do not use more than 50% of your computer RAM – remember, that operating system and other applications also use this memory. If PhpStorm will allocate most of your computer memory, other processes will use hard disk to store required data – even SSD drives are terrible slow in comparsion to RAM so… do not do this.