cancel
Showing results for 
Search instead for 
Did you mean: 

Could not reserve enough space for object heap - Alfresco build from source

pradeepsimha
Champ in-the-making
Champ in-the-making
I am trying to build Alfresco from source and I am following the instructions from https://wiki.alfresco.com/wiki/Alfresco_SVN_Development_Environment link.But whenever I try to execute below command:

ant build-tomcat


I get the following error:

[mkdir] Created dir: E:\Pradeep\Alfresco\Alfresco Source\root\projects\core\build\classes
[javac] Compiling 159 source files to E:\Pradeep\Alfresco\Alfresco Source\root\projects\core\build\classes
[javac] Error occurred during initialization of VM
[javac] Error: Could not create the Java Virtual Machine.
[javac] Error: A fatal exception has occurred. Program will exit.
[javac] Could not reserve enough space for object heap


I tried setting heap size using following environment variable:

 JAVA_OPTS = -Xms256m -Xmx512m 

I played with various values like 1333M, 1024M, 64M etc. But still I get same error. Even I tried to play around with the values in \root\modules\wcmquickstart\build.properties mem.size.max value, but still issue persists.

Can anyone kindly help me in this, since I am beginner to Alfresco? Admittedly I have posted question in Stackoverflow, but I have not got response, so I am posting in official forum.
5 REPLIES 5

abarisone
Star Contributor
Star Contributor
Hi,
usually change tomcat/bin/catalina.sh file setting JVM parameteres upon your needs.
For example I added export JAVA_OPTS='-server -Xmx8g -Xms8g -Xss256k -XX:MaxPermSize=512m -XX:NewSize=4g -Dfile.encoding=UTF-8' where
<blockcode>
-XX:NewSize=2m
Default size of new generation (in bytes) [5.0 and newer: 64 bit VMs are scaled 30% larger; x86: 1m; x86, 5.0 and older: 640k]
-XX:MaxPermSize=64m Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.]

-Xmx <size>[g|G|m|M|k|K] This option sets the maximum Java heap size. The Java heap (the “heap”) is the part of the memory where blocks of memory are allocated to objects and freed during garbage collection. Depending upon the kind of operating system you are running, the maximum value you can set for the Java heap can vary.

-Xms<size>[g|G|m|M|k|K] The -Xms option sets the initial and minimum Java heap size. The Java heap (the “heap”) is the part of the memory where blocks of memory are allocated to objects and freed during garbage collection.

-Xss<size>[g|G|m|M|k|K] -Xss sets the thread stack size. Thread stacks are memory areas allocated for each Java thread for their internal use. This is where the thread stores its local execution state.
</blockcode>
Regards,
Andrea

Thanks for reply, But still I am building the source right? Does it have affect on Tomcat now? And I am using Windows 7.

abarisone
Star Contributor
Star Contributor
Yes, you're right, but the meaning of the post is to explain the various parameter you can use with Javz.
The fact you're compiling or running an application doesn't matter.
Try to figure out where is the exact point you're going out of perm gen memory and focus on it.

Regards,
Andrea

Yes you're correct. I am trying to analyse, the exact error is occurring while compiling the Java files, I even added attributes to javac tag to increase heap size. But it's not working. So I thought to post here maybe someone is facing same issue as me Smiley Happy

Hi Pradeep,

If you are using windows7 then add the following line in startup.bat and catalina.bat file.

set JAVA_OPTS=-Xms1024m -Xmx1024m -XXSmiley TongueermSize=256m


and also set java_opts and catalina_opts in environment variables.


Hope this helps!

Nancy