Java - OutOfMemoryError: PermGen space

Nugget picture Nugget · Jul 27, 2011 · Viewed 28.4k times · Source

I'm currently developing a tool allowing me to get statistics from anyware simply by going on a website I also created.

For those who don't know, Birt is a reporting tool, and an eclipse plugin.

My problem is the following :

I installed tomcat on the server hosting my website, and installed the Birt ReportEngine on it, and on my website, I call the online viewer to get my reports.

The problem is that since yesterday, when I launch a report, I have this error :

javax.servlet.ServletException: L'exécution de la servlet a lancé une exception
    org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)

Caused by :

java.lang.OutOfMemoryError: PermGen space

I don't really know which config file to modify to avoid this error. I found some examples online that tell to modify the eclipse.ini file, but as for mty website, I don't use eclipse, I didn't found any usefull post.

Can someone help me please ?

Thanks

Answer

Pierre Henry picture Pierre Henry · Jul 27, 2011

As said by Thomas, the parameter to set is -XX:MaxPermSize. One way of setting this parameter for Tomcat is to use the CATALINA_OPTS environment variable.

For Windows :

set CATALINA_OPTS=-Xms512m -Xmx512m -XX:MaxPermSize=256m

For Linux (bash) :

export CATALINA_OPTS="-Xms512m -Xmx512m -XX:MaxPermSize=256m"

Check the startup.bat and catalina.bat or startup.sh and catalina.sh files in your tomcat/bin directory and add the above commands there.

(The Xmx and Xms parameters set the minimum and maximum size for the Java heap - where objects are stored. This is not the problem you have but I included them for the sake of completeness.)