GWT, Maven - Could not reserve enough space for object heap
I'm trying to build a GWT project, using Maven. When gwt-maven-plugin tries to compile the code, it throws an error:
[ERROR] Error: Could not create the Java Virtual Machine. [INFO] Could not reserve enough space for object heap
I tried mvn -Dgwt.extraJvmArgs=-Xmx1280m clean install, it didn't help.
An obvious solution is usually to set MAVEN_OPTS system variable. So, I've added MAVEN_OPTS with value -XX:MaxPermSize=512m -Xmx1280m. If I run echo %MAVEN_OPTS%, I see -XX:MaxPermSize=512m -Xmx1280m.
Now, if I try to run mvn clean install, I get:
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.
That's strange, because task manager says, that I have 5.9 Gb of available RAM. Why can this error be thrown? Why cannot it reserve the desired space? I'm using 32-bit JVM and Windows 8.
UPDATE: 64-bit JVM helped. I didn't think, that -XX:MaxPermSize=512m -Xmx1280m is too much for 32-bit JVM.
You need to pass the configuration to the gwt-maven-plugin via
mvn -Dgwt.extraJvmArgs=-Xmx1280m clean install
You could also try to reduce the amount of memory:
Could not reserve enough space for object heap
This sounds like the JVM can't reserve the desired space. Try -Xmx1024m or -Xmx768m.
If this also doesn't work, you could try to use a 64 bit JVM to compile the code.