HowToDealWithOutOfMemoryError
Contents
1. The Problem
java.lang.OutOfMemoryError: Java heap space
This is a problem many people run into. Default setting in Tomcat is to use only a little part of your RAM capacity. You need to increase the available memory for tomcat.
2. The Solution
2.1. For Tomcat 5.5 without install (zip file)
Go to the Tomcat installation folder, and into the sub-folder "bin". There you find the file catalina.bat (for windows) or catalin.sh (for Linux). Within this file you have to increase the heap space:
Linux: catalina.sh
JAVA_OPTS="-Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=256M"
Windows: catalina.bat
set JAVA_OPTS=-Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=256M
The important value is "Xmx".
You need at least 512m, but 1024m is better, if you have enough RAM.
2.2. For Tomcat 5.5 with windows install
add following lines in Java Options of part Java of Apache Tomcat Properties:
-Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=256M
The important value is "Xmx".
You need at least 512m, but 1024m is better, if you have enough RAM.