Tomcat java.lang.OutOfMemoryError: PermGen space

Teddy Zugana
Jun 15, 2022

Steps to increase PermGen Heap Space in Tomcat:

1) Go to Tomcat installation directory i.e C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.14\bin in Windows and something similar in Linux.

2) Add JAVA_OPTS in your catalina.bat or Catalina.sh

In Windows:

set JAVA_OPTS=”-Xms1024m -Xmx10246m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m”

In linux:

export JAVA_OPTS=”-Xms1024m -Xmx10246m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m”

You can change the actual heap size and PermGen Space as per your requirement.

3) Restart Tomcat.

As I said earlier increasing PermGen space can prevent java.lang.OutOfMemoryError: PermGen in tomcat only for some time and it will eventually occur based on how many times you redeploy your web application, its best to find the offending class which is causing a memory leak in tomcat and fix it.

Read more: https://javarevisited.blogspot.com/2012/01/tomcat-javalangoutofmemoryerror-permgen.html#ixzz7WFe3vD98

--

--