There are lots of questions that ask this or a similar question.
They all give the command that has to be executed, what I don\'t understand is where do I write this
Just set this extra line in catalina.bat
file
LINE NO AROUND: 143
set "CATALINA_OPTS=-Xms512m -Xmx512m"
And restart Tomcat service
There is a mechanism to do it without modifying any files that are in the distribution. You can create a separate file %CATALINA_HOME%\bin\setenv.bat
or $CATALINA_HOME/bin/setenv.sh
and put your environment variables there. Further, the memory settings apply to the JVM, not Tomcat, so I'd set the JAVA_OPTS
variable instead:
set JAVA_OPTS=-Xmx512m
Here you can add in VM arguments after endorsed
-Xms64m -Xmx256m
First of all you cannot change the memory settings only for a tomcat application but rather for all tomcat instance.
If you are running tomcat from console (using startup.bat) you'll need to edit catalina.bat and play around with CATALINA_OPTS. For example:
set CATALINA_OPTS=-Xms512m -Xmx512m
Restarting tomcat will apply the new settings.
If you are still getting OutOfMemoryError you need to know how much memory does your application need at that particular moment (nom.tam.util.ArrayFuncs...). You'll either have to optimize the application or simply increase the memory provided to tomcat.
you can set this in catalina.sh as CATALINA_OPTS=-Xms512m -Xmx512m
Open your tomcat-dir/bin/catalina.sh file and add following line anywhere -
CATALINA_OPTS="$CATALINA_OPTS -Xms1024m -Xmx3024m"
and restart your tomcat
You need to add the following lines in your catalina.sh
file.
export CATALINA_OPTS="-Xms512M -Xmx1024M"
UPDATE : catalina.sh
content clearly says -
Do not set the variables in this script. Instead put them into a script setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
So you can add above in setenv.sh instead (create a file if it does not exist).