Derwyn
posted this on October 20, 2010 11:15 am
There are probably multiple options to set the memory settings but this is the way I've done it.
From within the Tomcat installation directory <tomcat>/bin edit the catalina.sh file.
Add this line (I added it just below where the comment section ends near the top)
CATALINA_OPTS="-Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true "
Save and restart Tomcat.
If you are getting some strange behavior like Tomcat won't start or you are still getting perm gen or heap errors chances are you have a typo in the line above. I know I did.
Note: The value 1024 is allocating 1G to Tomcat. This is the minimum and is what I use for my local machine to do demos. If you are installing on a production, it is recommended to increase this. How much is a up to you. The more the better. It more depends on the size of the server and other applications that might be running on it. A general rule is to allocate half of the available memory but if your server has 32G of RAM then allocating 15G to Tomcat would be extreme.