Java.lang.OutOfMemoryError: PermGen space

How can I prevent this?

Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space Exception in thread "main" java.lang.OutOfMemoryError: PermGen space Exception in thread "Thread-2" java.lang.OutOfMemoryError: PermGen space 

This happens, for example, if I frequently reload the data page. I understand that something is wrong with the garbage collector.

I am using Eclipse Java EE IDE, JSF2, richfaces4

+4
source share
3 answers

This applies to Tomcat. This is a pretty bad hotpublisher / hotdeployer and it suffers from memory leaks. I suggest disabling autorun on the server configuration screen in Eclipse and simply manually restarting Tomcat when you want to reflect saved changes. Restarting should not take much time if you have only one project.

Glassfish, for example, is much more reliable (and faster!) When it comes to hotpublishing. Regarding installing Glassfish and integrating it into Eclipse to develop JSF 2.0, check out this tutorial .

+10
source

You should allocate more space for PermGenSpace for the tomcat JVM.

This can be done using the JVM argument: -XX:MaxPermSize=128m

By default, the PermGen space is 64M (and it contains all the compiled classes, so if you have a lot of jar (classes) in your class path, you can really fill that space).

On a side note, you can control the size of the PermGen space using JVisualVM , and you can even check its contents using YourKit Java Profiler

0
source

If you have more projects in the webapps folder, this exception will appear. Excluding some projects, this exception will not appear.

-1
source

All Articles