GLA GLA - 6 months ago 17
Linux Question

Tomcat 7: How to set initial heap size correctly?

I was trying to adjust initial heap size of a tomcat 7 (CentOS, java -version: 1.6.0_25-b06) instance by adding the following line to catalina.sh:

export CATALINA_OPTS="-Xms=512M -Xmx=1024M"


Starting up tomcat fails and logs the following message to catalina.out:

Invalid initial heap size: -Xms=512m
Could not create the Java virtual machine.


What is wrong with these options?

Answer

You must not use =. Simply use this:

export CATALINA_OPTS="-Xms512M -Xmx1024M"