7

Not sure who is responsible for this error:

Exception in thread "main" java.lang.OutOfMemoryError: PermGen space

This error occurs whey I try to run my spring web app in Debug mode from the IntelliJ IDEA 10.5 (my project is maven format project).

When running the same application from the standalone Tomcat 7 Web server (put war into webapps folder) it works fine. Also from mvn clean install t7:run-forked application also works fine.

My app is Spring JPA application using Hibernate as JPA provider, c3p0 is used for connection pooling (switched to it from bonecp, thought that the bonecp was the cause of this error, but it is still reproducible with c3p0 too), Spring TomcatInstrumentationLoading is used for JPA support on Tomcat.

My OS is Debian, Linux.

2 Answers 2

27

This should be enough to make it work:

-XX:MaxPermSize=256m

VM options field is set in the Tomcat Run/Debug configuration to

-XX:MaxPermSize=256m

1
  • Cool!! This solved the problem for me. Thanks soo much. My problem was occurring when running unit tests, but I was able to apply the same concept to my unit test run configuration.
    – Dan Torrey
    Commented May 16, 2014 at 18:17
5

Set VM arguments to allocate more space for your program

like

-Xms128m -Xmx8192m -XX:PermSize=128m -XX:MaxPermSize=256m 
1
  • 5
    You should explain those arguments. The first two ones don't have anything to do with the permgen space, and 8 GBs is a lot more than typical dev machines can support.
    – JB Nizet
    Commented Dec 30, 2011 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.