If you see a message "java.lang.OutOfMemoryError: Java heap space" or "java.lang.OutOfMemoryError: PermGen space" in the log files then this indicate that the Tomcat server needs more memory allocated to it.
How to set java heap size in Tomcat?
Stop Tomcat server, set environment variable CATALINA_OPTS, and then restart Tomcat. Look at the file tomcat-install/bin/catalina.sh or catalina.bat for how this variable is used. For example,
set CATALINA_OPTS=-Xms2048m -Xmx4096m (Windows, no "" around the value)
export CATALINA_OPTS="-Xms2048m -Xmx4096m" (ksh/bash, "" around the value)
setenv CATALINA_OPTS "-Xms2048m -Xmx4096m" (tcsh/csh, "" around the value)
On Linux this may also be set in the setenv.sh file with a row like this:
export JAVA_OPTS="-server -Xms2048m -Xmx4096m -XX:MaxPermSize=512m ...<other props>..."
To make sure that the correct memory settings are applied in Linux you can run the following command:
jinfo -flags <PID_Of_JavaProcess>
To find the process id of Java you can for example run the following:
top | grep java
Max perm size
If you are getting "java.lang.OutOfMemoryError: PermGen space" you could set the "Max perm size" to for example 512Mb with this "-XX:MaxPermSize=512m".
Memory settings in windows
To change the memory settings when running Tomcat as a windows service you go to the <TomcatHome>/bin directory and then run the executable "tomcat7w.exe". In the windows that opens up klick on the "Java" tab and then specify the settings as below:
More information on how to increase the memory settings for Tomcat services in Windows can be found here: http://www.zulutown.com/blog/tag/maxpermsize/