Java - OutOfMemoryError: PermGen space
Asked Answered
P

5

13

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

Populace answered 27/7, 2011 at 11:57 Comment(0)
E
16

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.)

Enedina answered 27/7, 2011 at 12:9 Comment(2)
Thanks for you help, i'll try this this afternoon and let you know about the result :)Populace
Good to know : in Java 8, there is no PermGen space any more, so this problem disappears :)Enedina
P
6

You need no add the following line to eclipse.ini

-XX:MaxPermSize=128m

If the problem occurs again try to increase the value. You can also add the following optional lines:

-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:+UseParNewGC 

This changes the Garbage Collector of the JVM to a more optimized one, and can also improve the performance and memory usage.

You may also want to tweak the values of the -Xmx and Xms options. Try small increases (same to the -XX:MaxPermSize) as this will increase the memory footprint of your JVM.

For a more explained details see here: http://www.eclipsezone.com/eclipse/forums/t61618.html

For a complete list of the JVM parameters and options: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

Printer answered 27/7, 2011 at 12:22 Comment(0)
C
4

Use that JVM option: -XX:MaxPermSize=256m (of course you are free to choose the amount of memory, but IIRC the default would be 64m so you'd need to increase that). - Note that this is for Oracle's JVM (formerly SUN's :) ) , other JVM's might have different options.

Other than that, try not hot deploying too much, since that might also increase the PermGen space usage (JBoss which includes Tomcat as has that problem, but I'm not sure whether that is true for a standalone Tomcat).

Chavannes answered 27/7, 2011 at 12:0 Comment(2)
I will always stumble over "Oracle's VM"... since they bought it from sun.Hawkshaw
@Daniel, yes I was about to write "SUN's JVM", then I remembered ... :)Chavannes
S
2

This can be solved by allocating more heap memory. this can be done as: steps: double click on your eclipse server->open launch configuration->Arguments->paste this line in vm arguments text area:-

-XX:MaxPermSize=512M -Xmx1024M This will solve your outofmemory error.

Seaton answered 2/8, 2011 at 4:59 Comment(0)
D
1

I added the below line line to eclipse.ini and working fine for me.

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256m
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
Dunn answered 13/8, 2013 at 9:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.