2

I am receiving the following error when trying to build a Java project in IntelliJ 14.0.3 with Apache Maven:

Error: Abnormal build process termination
       Error occurred during initialization of VM
       Could not reserve enough space for object heap
       Error: Could not create the Java Virtual Machine
       Error: A fatal exception has occurred. Program will exit.

I am using Java 1.7.0_75. However, if I switch the project to use Java 1.8.0_25 then the project will build. The only issue with this is that I am using Spring 2.5, which thinks that Java 1.8 is Java 1.4 and this causes other problems. Unfortunately upgrading Spring is not an option.

I am running Windows 7 Enterprise 64 bit with 8gb of RAM, recently upgraded from 4gb. There is plenty of free memory available when I am getting this error, and I've allocated 1024mb to IntelliJ in the idea.exe.vmoptions file.

This problem doesn't seem to happen for other people building the same project with the same version of Java. They are using IntelliJ 13.1.4, and they also have only 512mb allocated in idea.exe.vmoptions. I originally was using IntelliJ 13.1.4 as well and receiving a similar error to what I'm receiving now.

Any ideas on what might be happening?


EDIT: For anyone who is interested, I still haven't figured out this error. I had my computer completely reimaged and the issue still seems to be occurring, which leads me to believe it could actually be something physical. I was also considering that maybe it has something to do with a memory leak or fragmented memory causing malloc to fail when java tries to allocate memory, but I'm not sure why that would be the case - especially when the same setup seems to work on other peoples' computers.

Kevin Tabb
  • 21
  • 4
  • Which build is failing... The `Build > Make Project` menu inside IntelliJ, or did you run a maven task explicitly from inside IntelliJ, using the `Maven Projects` tool window? – Alex Feb 13 '15 at 12:47
  • It's the `Build > Make Project` which is failling – Kevin Tabb Feb 13 '15 at 12:51
  • In the `Maven Projects` tool window, goto your project and run the `clean` task. The output in the `Run` tool window's first line will be the complete command line used, post it in your question so we can see what memory options it's being passed. – Alex Feb 13 '15 at 12:53
  • The first line of the output is: `"C:\Program Files (x86)\Java\jdk1.7.0_75\bin\java" -Dmaven.home=C:\dev\maven\apache-maven-3.2.5 -Dclassworlds.conf=C:\dev\maven\apache-maven-3.2.5\bin\m2.conf -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\dev\maven\apache-maven-3.2.5\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=14.0.3 clean ` – Kevin Tabb Feb 13 '15 at 13:30

2 Answers2

1

Do you have explicit memory settings for XX:MaxPermSize= perhaps? This error means that the JVM couldn't startup because the options presented to it didn't leave enough memory for the heap space.

The difference with Java 8 is probably because Java 8 no longer has a permanent generation space in the JVM, so the XX:MaxPermSize option gets ignored.

See Could not reserve enough space for object heap as an example of this kind of error.

You can change the memory options that would be passed to the maven commands in the IntelliJ Preferences under Build, Execution, Deployment > Build Tools > Maven > Runner and set them in the VM Options text box. Working under the assumption you have a XX:MaxPermSize setting already, you could try something like this:

-XX:MaxPermSize=256m -Xmx1024m

Which sets the max allocation pool to 1024 MB and up to 256 MB for the PermGen

Community
  • 1
  • 1
Alex
  • 2,435
  • 17
  • 18
  • I did have a MaxPermSize set. I tried raising it, deleting it entirely, and also adding the MaxHeapSize option from that question that you linked to. Unfortunately none if this changed the error I was getting :( I think that, considering the same project, Java version, and memory situation works fine on other peoples' computers, it must be something specifically wrong with the way I have something set up on my computer, or maybe even with my computer itself. I just don't know what that would be. – Kevin Tabb Feb 13 '15 at 13:29
  • If something like the example memory options that I posted still results in the JVM not starting, then something else must be changing the JVM options that maven is starting with. Do you have a `MAVEN_OPTS` environment variable set on your OS? – Alex Feb 13 '15 at 13:36
  • I don't seem to have a `MAVEN_OPTS` environment variable, but you are probably right that something else is changing the JVM options that maven is starting with. – Kevin Tabb Feb 13 '15 at 14:01
0

I got the same error when trying to run the application using Run-->Debug and the "Error: Abnormal build process termination" message just wouldn't go away. I then tried running the application using Run-->Run and it ran successfully. Went back and tried to Debug the application and it started working. Not sure if this would have helped in your case but thought I'd share my experience.

Sanjiv Jivan
  • 1,922
  • 18
  • 19