Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 586
GLA Avatar asked Aug 01 '11 11:08

GLA


People also ask

What is the default heap size in Tomcat 7?

By default, the maximum heap size value is 256 MB.

How do I fix invalid initial heap size?

64 bit JVM installed on Solaris machines runs with a 32-bit model if you don't specify either -d32 or -d64, which won't accept a Maximum heap size of 4GB, hence "invalid heap size". You can resolve this issue by running Solaris JVM with option -d64.


1 Answers

You must not use =. Simply use this:

export CATALINA_OPTS="-Xms512M -Xmx1024M" 
like image 167
Joachim Sauer Avatar answered Oct 02 '22 20:10

Joachim Sauer