Increase Tomcat memory settings

IAmYourFaja picture IAmYourFaja · Oct 2, 2012 · Viewed 301.4k times · Source

Possible Duplicate:
Dealing with “java.lang.OutOfMemoryError: PermGen space” error

I have 8GB RAM in my development machine, and am trying to run Apache Tomcat (7.0.29) to host both Artifactory (2.6.3) and Jenkins (1.479) at the same time. I tried to find the memory requirements for Jenkins but it looks like their wiki is down.

In ${TOMCAT_HOME}/bin/catalina.sh, I have added the following command:

CATALINA_OPTS="$CATALINA_OPTS -server -Xms1024m -Xmx3052m"

This should keep Tomcat's JVM between (essentially) 1 and 3 GB in size, leaving me plenty of room for other stuff, and giving Tomcat enough memory for Artifactory/Jenkins, and even others if I wanted.

(For what it's worth I've tried the same with JAVA_OPTS only to get the same exact result). I save that change and run startup.sh. Tomcat begins to start up, and then dies with OOMEs complaining that Tomcat has ran out of PermGen space:

Exception in thread "SocketListener(<hex-stuff>.local.)"
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space
Exception in thread "hudson initialization thread" java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space

Where am I going awrye here? I have read multiple articles on how to do this and (believe!) I'm following them precisely. Any thoughts, or ideas as to how I could debug this further? Thanks in advance!

Answer

sgpalit picture sgpalit · Oct 2, 2012

try setting this

CATALINA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

in {$tomcat-folder}\bin\setenv.sh (create it if necessary).

See http://www.mkyong.com/tomcat/tomcat-javalangoutofmemoryerror-permgen-space/ for more details.