Search code examples
javalinuxtomcat7heap-memory

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?


Solution

  • You must not use =. Simply use this:

    export CATALINA_OPTS="-Xms512M -Xmx1024M"