Friday, January 15, 2010

Add more JVM memory in tomcat on ubuntu 9.10

I tried to change CATALINA_OPTS AND JAVA_OPTS with no success in increasing memory for my tomcat6 on ubuntu 9.10. I tried in /etc/enviroment, I tried export CATALINA_OPTS AND JAVA_OPTS="-xMX1024M" with no success. But I found you can edit the init.d/tomcat6 and works great.

- permgen size is the application size, or how much memory you need for the application

- xmx max memory size that will be needed for operation of the application

#change the attributes in: /etc/init.d/tomcat6
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -XX:MaxPermSize=256m"
fi

4 comments:

Thomas said...
This comment has been removed by the author.
Thomas said...

The debian way to edit the settings is to edit JAVA_OPTS in /etc/default/tomcatX.X. Thats why they check if JAVA_OPTS is set (-z).

If you edit the startup script, your changes will be overwritten by an aptitude upgrade.

laralar said...

Shouldn't you set CATALINA_OPTS in that file instead?

According to the docs.. JAVA_OPTS is also used when stopping an application,

GedroX said...

Thank you, Thomas. You saved me.

Trying out the Dart Analysis Server

I wanted to see how the Dart Analysis Server was put together and worked. I started looking to see how I could wire it up and try out the co...