I am running Tomcat on a small VPS (256MB/512MB) and I want to explicitly limit the amount of memory Tomcat uses.
I understand that I can configure this somehow by passing in the java maximum heap and initial heap size arguments;
-Xmx256m
-Xms128m
But I can't find where to put this in the configuration of Tomcat 6 on Ubuntu.
Thanks in advance,
Gav
You can add this to the
JAVA_OPTS
variable in thebin/catalina.sh
startup script.JAVA_OPTS="-Xms128m -Xmx256m"
On Ubuntu, the correct way to customize Tomcat variables is by editing the file
(or
/etc/default/tomcat6
if you have a newer version running)Inside that file, set the JAVA_OPTS variable as described in the other replies here, for example
JAVA_OPTS="-Xmx512m"
to set a maximum memory of 512 MB.
Set JAVA_OPTS in your init script,