0

I start working with Alfresco system. My PC is 32-bit. I have a problem:

 [exec]  T E S T S  
 [exec] Error occurred during initialization of VM
 [exec] Could not reserve enough space for object heap
 [exec] Error: Could not create the Java Virtual Machine.
 [exec] Error: A fatal exception has occurred. Program will exit.
 [exec] Results :
 [exec] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
 [exec] [INFO] Total time: 8.556 s
 [exec] [INFO] Finished at: 2015-07-06T12:12:51+02:00
 [exec] [INFO] Final Memory: 27M/64M
 [exec] [INFO] ------------------------------------------------------------------------
 [exec] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project spring-surf-core: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
 [exec] [ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_79\jre\bin\java" -Xmx2G -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote -jar C:\alfr\alfresco\projects\surf\spring-surf-core\spring-surf-core\target\surefire\surefirebooter1762228666106185177.jar C:\alfr\alfresco\projects\surf\spring-surf-core\spring-surf-core\target\surefire\surefire5748163713411457336tmp C:\alfr\alfresco\projects\surf\spring-surf-core\spring-surf-core\target\surefire\surefire_04790546620732481422tmp"
 [exec] [ERROR] -> [Help 1]
 [exec] [ERROR] 
 [exec] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
 [exec] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
 [exec] [ERROR] 
 [exec] [ERROR] For more information about the errors and possible solutions, please read the following articles:
 [exec] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
 [exec] [ERROR] 
 [exec] [ERROR] After correcting the problems, you can resume the build with the command
 [exec] [ERROR]   mvn <goals> -rf :spring-surf-core

BUILD FAILED
C:\alfr\alfresco\build.xml:46: exec returned: 1

I was trying every heap size in eclipse.ini, but it's still the same. I have 4GB RAM.

How am I supposed to set Xmx and Xms?

xrcwrn
  • 5,339
  • 17
  • 68
  • 129
  • you can set maven_opts in environment variable. – Krutik Jayswal Jul 06 '15 at 10:48
  • possible duplicate of [java.lang.OutOfMemoryError: Java heap space in Maven](http://stackoverflow.com/questions/4066424/java-lang-outofmemoryerror-java-heap-space-in-maven) – Gimby Jul 06 '15 at 11:32

2 Answers2

0

I can see thant you are using maven to run it then you should try this :

set MAVEN_OPTS=-Xmx512m  

or you can try

 set MAVEN_OPTS=-Xmx1024m

In windows you can set the environement variable MAVEN_OPTS and set it's value with chosen one

bmscomp
  • 777
  • 1
  • 11
  • 21
0

The JVM tells you that it "could not reserve enough space for object heap", which means your -Xmx is most likely set too large.

From your command it seems you're trying to use 2G, which is probably more than your 32bit JVM can handle.

The Oracle FAQs suggest that the maximum value for 32bit JVMs is somewhere between 1.4G and 1.6G:

Why can't I get a larger heap with the 32-bit JVM?

The maximum theoretical heap limit for the 32-bit JVM is 4G. Due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower. On most modern 32-bit Windows systems the maximum heap size will range from 1.4G to 1.6G. On 32-bit Solaris kernels the address space is limited to 2G. On 64-bit operating systems running the 32-bit VM, the max heap size can be higher, approaching 4G on many Solaris systems.

You should try a smaller -Xmx setting, maybe something around 1024m. I cannot tell you the optimal setting as this depends on the concrete task, maybe even less will do fine (the JVM will also tell you if it runs out of heap memory).

Marvin
  • 13,325
  • 3
  • 51
  • 57