Monday, 24 December 2012

Resolve problem of Could not reserve enough space for object heap


Some time you will get  Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.

It's noting you have to allocate enough Heap space for java

In Tomcat setClasspath.sh file just add below variable
export JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Xss2m"

In normally you can run like this also


Suppose your class is called Test in package mypackage. Run your code like this:

java -Xmx1024m mypackage.Test

In Maven  Pom.xml  set like that


<configuration>
    <maxmemory>1024M</maxmemory>
</configuration>


No comments:

Post a Comment