Jump to Navigation

223 - java.lang.OutOfMemoryError (Tomcat)

You ran out of memory and GC stands for Garbage Collector. If your garbage collector is spending too much time freeing memory
because of a memory shortage, you'll get this error.

* java.lang.OutOfMemoryError: GC overhead limit exceeded

To solve this issue :

Edit the file /usr/local/apache-tomcat-6.0.26/bin/catalina.sh and alter the following line, substituting for the desired values.

CATALINA_OPTS="$CATALINA_OPTS -Xms256m -Xmx512m $JPDA_OPTS"

CATALINA_OPTS is used to control Tomcat environment options, whereas JAVA_OPTS controls the environment options at a
higher level ie. for any Java library.

For example if you want to allocate a minimum heap size of 256MB and a max heap size of 512MB you will have to write the following on Linux :

CATALINA_OPTS="-Xms256m -Xmx512m"

To increase the maximum JVM heap size, use the -Xmx option. To limit the proportion of VM spent in garbage collection before an
OutOfMemoryError is thrown, use -XX:UseGCOverheadLimit. In Tomcat, this can be set using the CATALINA_OPTS variable, as in catalina.sh:

CATALINA_OPTS="-Xms256 -Xms512m -XX:-UseGCOverheadLimit"

 

 



Main menu 2

Story | by Dr. Radut