11

I just upgraded to IntelliJ IDEA 12.0 and get an error immediately upon attempting to launch:

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 checked my idea.exe.vmoptions file and the maximum heap size is only 640m (I have 8 GB physical memory and am not running any other applications).

idea.exe.vmoptions

-Xms128m
-Xmx640m
-XX:MaxPermSize=640m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-ea
-Dsun.io.useCanonCaches=false

I still have IntelliJ IDEA 11.4 on my machine and I am able to run that (using the same values for max heapsize in idea.exe.vmoptions). Since IntelliJ IDEA 11.4 runs, I don't believe it is an antivirus or firewall issue. I have also checked those settings as well.

Anyone run across this or have any idea (no pun intended)?

Philip Tenn
  • 6,003
  • 8
  • 48
  • 85
  • possible duplicate of [How to increase intellij 32bit xmx more than 1GB?](http://stackoverflow.com/questions/13489469/how-to-increase-intellij-32bit-xmx-more-than-1gb) – kamaci Jan 29 '13 at 08:40

4 Answers4

6

Please see this answer for the problem background and the solution.

Your questions seems to be the exact duplicate of:

Community
  • 1
  • 1
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 1
    Thanks, but that is not the same as my problem. I am not trying to go over 1GB, I have set my Max Heap Size Xmx to 640m (well below 1GB). Memory fragmentation should not come into play because I've closed down all other applications and have 8GB of physical memory. – Philip Tenn Dec 12 '12 at 16:22
  • 1
    `-XX:MaxPermSize=640m` + `-Xmx640m` + `-XX:ReservedCodeCacheSize=64m` = **1344m**, you are already far beyond the "safe" 1G. And you can't be sure about fragmentation. If you want to overcome this limit, run under 64-bit JDK. With 32-bit JDK it doesn't matter how much RAM you have. – CrazyCoder Dec 12 '12 at 16:26
  • Thank you. I did not realize that it was additive for those JVM options. I did read your other Stackoverflow answer and also http://devnet.jetbrains.net/docs/DOC-1185. Based on that article, I set up everything to use idea64.exe and I no longer get the startup error. – Philip Tenn Dec 12 '12 at 16:37
  • 1
    This is not anywhere to being an "exact duplicate" of the question you mentioned. -1 – B T Jun 17 '15 at 01:36
  • @PhilipRego your problem is completely unrelated. – CrazyCoder Aug 22 '19 at 17:30
5

Assuming you are on windows I am curious why you are running the 32bit version of intellij when you have a 64bit machine?

I was having the same error and found that there was two things going on. The first was that the link I had in the taskbar was pointing to the idea.exe instead of the idea64.exe, which meant I was only launching the 32bit version of intelliJ.

Second there is another file for vm options for the 64bit. idea64.exe.vmoptions

After switching to the 64bit exe and making sure the vm options I wanted were correct in the vmoptions file I did not have any further issues.

On another interesting note I found that on 32bit machines when the 32bit version of intelliJ was set to have 1gb of memory for -Xmx and I had chrome open I would get the error. If I closed chrome I would no longer get the error. I think this had something to do with the jvm verifying that the required amount of memory was available before launching.

zmanc
  • 5,201
  • 12
  • 45
  • 90
4

Try to configure your idea to the default values

-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-ea
-Dsun.io.useCanonCaches=false

VM options are loaded from the IDE_HOME\bin\[bits][.exe].vmoptions file.

More info: https://intellij-support.jetbrains.com/entries/23393413-The-JVM-could-not-be-started-The-main-method-may-have-thrown-an-exception

B T
  • 57,525
  • 34
  • 189
  • 207
Dan Moldovan
  • 371
  • 3
  • 3
1

I found that switching from a 32-bit version to a 64-bit version caused the issue, as my windows shortcuts still pointed to the old idea.exe and not the correct idea64.exe.

Agnes
  • 654
  • 6
  • 11