[opencms-dev] java heap exhausted during publishing

John Fereira jaf30 at cornell.edu
Fri Mar 14 18:33:45 CET 2008


Christoph P. Kukulies wrote:
> Just an observation:
>
> I published in one chunk about 1800 items in 5 folders
> and when the progress bar appears with in the "Publish Project"
> it does steps 1 to 4 and in step 4 at 99% it says in red (while writing html
> as it says):
>
> --------------------------------
> Error while executing thread for progress. Java heap space
> java.lang.OutOfMemoryError: Java heap space.
>
> This is on a machine with little resources though, but could it be
> something not very efficient of memory consuming is done here
> in java?
>   
I didn't see an answer to this but it's probably not actually an opencms 
question as it is an web application container question.  If you're 
using Tomcat, by default it starts up a JVM with the default Min/Max 
heap memory (64M).  If you're just dropping the war file into a 
container, opencms is just going to run using whatever memory 
configuration you have for that container.

If you're running Tomcat, you can try doing what I do.  In the 
catalina.sh or catalina.bat file that is used to start up the container 
it checks for the existence of a file called setenv.sh or setenv.bat.  
If it finds it reads any jvm configuration options out of that file.  
Here's what one of mine looks like:

JAVA_HOME=/usr/local/jdk1.5.0_07
TOMCAT_HOME=/usr/local/apache-tomcat-5.5.17
CATALINA_HOME=/usr/local/apache-tomcat-5.5.17

JAVA_OPTS="-Dfile.encoding=UTF-8 -server -verbose:gc -XX:+PrintGCDetails 
-Xloggc
:/usr/local/apache-tomcat-5.5.17/logs/gc.log -Xms256M -Xmx256M 
-XX:MaxPermSize=8
0M -XX:+HeapDumpOnOutOfMemoryError "
 
export JAVA_HOME TOMCAT_HOME CATALINA_HOME JAVA_OPTS

Of particular interest are these options:

-Xms256M -Xmx256M

If the Xms and Xmx options are not specified they default to 64M.  I've 
got a pretty robust web application
running in the Tomcat container for this instance and it just runs and 
runs.  I have no idea what the optimal value might be for running 
OpenCMS, but while 64M is enough to run many smaller applications, it's 
not enough for something more robust.

The other options of interest is:

-XX:+HeapDumpOnOutOfMemoryError

This will produce a heap dump if you still encounter an OutOfMemory 
exception.   Memory profiling tools such as YourKit can read this dump 
file to determine where a memory leak may be occuring.




>
> --
> Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>   




More information about the opencms-dev mailing list