Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase Tomcat memory settings [duplicate]

Tags:

memory

tomcat

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!

like image 606
IAmYourFaja Avatar asked Oct 02 '12 10:10

IAmYourFaja


People also ask

How much memory should I allocate to Tomcat?

In general, a minimal install requires 4GB for the OS, the tomcat heap XMS setting (default 4GB), 2GB for Retain and any memory the database requires if installed. In all cases, when only the worker is installed the memory is automatically tuned to 3GB.

What is XMS and XMX in Tomcat?

The flag Xmx specifies the maximum memory allocation pool for a Java virtual machine (JVM), while Xms specifies the initial memory allocation pool. This means that your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory. answered Nov 14, 2018 by Maverick.

What is initial memory pool for Tomcat?

Increase the default Initial memory pool value from 4096 MB to 6144 MB and the default Maximum memory pool value from 6144 MB to 8192 MB, depending on your computer's memory capabilities, then click OK. Start the Tomcat server by navigating to the server\pentaho-server\tomcat\bin folder and double-clicking the startup.


1 Answers

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.

like image 114
sgpalit Avatar answered Sep 29 '22 13:09

sgpalit