TurnKey Linux Virtual Appliance Library

Cannot change java heap size allocation for tomcat

linoan's picture


I have a web app that eats a little above 512mb.

-server -Xms384M -Xmx512M -XX:MaxPermSize=256M

I tried increasing this but it does not reflect anything...

export CATALINA_OPTS = "-server -Xms1024M -Xmx1024M -XX:MaxPermSize=256M"
-server -Xms384M -Xmx512M -XX:MaxPermSize=256M

How to change this settings? Is there some kinda override in our turnkey tomcat installation?

Adrian Moya's picture

Have you tried editing tomcat configuration files?

I don't have this appliance at hand, but configuration of these parameters are always set in a file. In tomcat 6 is /etc/default/tomcat6 but I suppose you're using tomcat5, so look for something like /etc/tomcat5/*. Look for the configuration file and where it says JAVA_OPTS= there's where you have to make the change. That way is going to be a permanent change even if you boot your VM.

Also try not leaving spaces between CATALINA_OPTS and the values:

export CATALINA_OPTS="-server -Xms1024M -Xmx1024M -XX:MaxPermSize=256M"

Sorry if it's too late for this info. 

Adrian Moya's picture

I've searched the file

Seems to be /etc/default/tomcat5.5 

Edit your file with "nano /etc/default/tomcat5.5" Ctrl+O to save and ctrl+x to quit. Ctrl+W to search for "JAVA_OPTS".

Check your current JAVA_OPTS and you can add lines like this at the end:

JAVA_OPTS="${JAVA_OPTS} -Xms1024m -Xmx1024m"

Hope it helps...

Linoan's picture


This is great! It is a little late but this info is really handy and helpful in the future.

I am a bit unfamiliar with turnkey but on my Ubuntu environment I always export these parameters.

Thank you very much. This is very much appreciated.


Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)