The JVM could not be started (maximum heap size issue)

I'm receiving the following error when starting the program after running PhpStorm for a while, closing the application and opening up again. AND when the computer has been on for several hours and I start PhpStorm for the first time (i.e. I have restarted the computer since last using). The error is occurring with the current release and the early access program release.

The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could block the execution.

I have done quite a bit of googling and searching on the forms here. I'm confused. My system is not inadequate. Please see the attached screenshot of my PC overview.

The steps I have taken to rectify the problem:

  • Disabled all firewalls and antivirus
  • Uninstalled all Java.
  • Uninstalled Phpstorm
  • Reinstalled only Phpstorm


If I restart the computer, I am able to open Phpstorm. If I start Phpstorm by clicking on `C:\Program Files (x86)\JetBrains\PhpStorm 126.162\bin\PhpStorm.bat` I am also able to start the program BUT I do not like having to keep the command line window open (one more window to clutter things). Obviously, restarting is starting to annoy me.

I love the program and would like to purchase a license once the next version comes out of testing but this issue is really wearing on me.

PHPstorm-system-screenshot.png

3 comments

Hi Mark,

Reinstalling will not help -- it's the JVM -- the way how memory manager works. JVM needs to allocate memory for Java application (PhpStorm in our case) in single solid block (IIRC). Any libraries that inject themself into process memory will reduce such solid block.


Few possible solutions:

  • Cleanup your system and uninstall/disable as many of such autoloading stuff as possible (context menu extensions, residental programms that can intercept global keys (e.g. Translator/Dictionary, IM, fraps, some graphic drivers have "hot keys" etc etc)
  • Launch PhpStorm via .bat file (is in PhpStorm_Install\bin folder) -- you will have console window open until you close PhpStorm .. but at least you can use it.
  • Increase (or decrease .. if you unable to launch it at all) -Xmx paremeter (edit PhpStorm_Install\bin\PhpStorm.exe.vmoptions file)
  • If project is big .. try excluding some not-so-necessary files ..like big images, sql dumps etc
  • Run it with 64-bit JVM (not sure if it is possible for PhpStorm on Windows)


P.S.
Better "official" links:

0

Launch PhpStorm via .bat file (is in PhpStorm_Install\bin folder) -- you will have console window open until you close PhpStorm .. but at least you can use it.


This is my preferred option, but the extra open command prompt is annoying. Found a workaround. Use the following to launch the .bat file and keep it hidden :)

Create .vbs file and paste code below. Then create a shortcut to file in Startup menu.

Const HIDDEN_WINDOW = 12

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objStartup = objWMIService.Get("Win32_ProcessStartup")

 

Set objConfig = objStartup.SpawnInstance_

objConfig.ShowWindow = HIDDEN_WINDOW

Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")

errReturn = objProcess.Create("C:\Program Files (x86)\JetBrains\PhpStorm 7.1\bin\PhpStorm.bat", null, objConfig, intProcessID)

0

Decreasing Xmx parameter from 1024 to 512 worked for me !

0

Please sign in to leave a comment.