OutOfMemoryErrors in Tomcat
The default memory settings of Tomcat are usually very low, especially regarding the PermGenSpace.
Please set the Maximum PermGenSpace to at least 256mb and the maximum heap space to the maximum you can expect to fit into physical memory. How to do this varies depending on where and how you install Tomcat (e.g. environment variables on Unix, tomcat7w.exe when using the Windows installer), so please consult the documentation applicable for your installation before applying the settings described here.
Running Tomcat as a Windows service:
In this scenario, please open tomcat7w.exe, the configuration tool for tomcat, switch to the Java tab, and
as shown in the following screenshot (here we assume that we can fit 8192mb into main memory).
<Please see attached file for image>
<Please see attached file for image>align="bottom" class="documentation" border="0" alt=".png" src="http://ecmstage.ca.com/KB%20Asset%20Library/000008496_Embeded/.png">
When using Tomcat on Windows (but not as a service) or on a Linux system
In this scenario, the startup scripts of Tomcat will pass the values in the CATALINA_OPTS environment variable to the JVM. To apply the same settings from the previous example, you would set the value to "-Xmx8192m -XX:MaxPermSize=256m" (without the quotes).
Note: With a 32 bit JVM, the maximum possible heap space is severely restricted. We recommend a 64bit JVM to be able to use all available RAM if necessary.