[tomcat] Increase Tomcat memory settings

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!

This question is related to tomcat memory

The answer is


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.


Examples related to tomcat

Jersey stopped working with InjectionManagerFactory not found The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat Spring boot: Unable to start embedded Tomcat servlet container Tomcat 404 error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start Kill tomcat service running on any port, Windows Tomcat 8 is not able to handle get request with '|' in query parameters? 8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE 403 Access Denied on Tomcat 8 Manager App without prompting for user/password Difference between Xms and Xmx and XX:MaxPermSize

Examples related to memory

How does the "view" method work in PyTorch? How do I release memory used by a pandas dataframe? How to solve the memory error in Python Docker error : no space left on device Default Xmxsize in Java 8 (max heap size) How to set Apache Spark Executor memory What is the best way to add a value to an array in state How do I read a large csv file with pandas? How to clear variables in ipython? Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine