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.
By default, Tomcat is assigned a very little PermGen memory for the running process. To fix it, increase the PermGen memory settings by using the following Java VM options. -XX:PermSize<size> - Set initial PermGen Size. -XX:MaxPermSize<size> - Set the maximum PermGen Size.
The default maximum memory size for 32-bit JVM is 64 MB and 82 MB for the 64-bit version. However, we can change the default size with the JVM options: -XX:PermSize=[size] is the initial or minimum size of the PermGen space. -XX:MaxPermSize=[size] is the maximum size.
OutOfMemoryError: PermGen Space is a runtime error in Java which occurs when the permanent generation (PermGen) area in memory is exhausted. The PermGen area of the Java heap is used to store metadata such as class declarations, methods and object arrays.
This should be enough to make it work:
VM options field is set in the Tomcat Run/Debug configuration to
-XX:MaxPermSize=256m
Set VM arguments to allocate more space for your program
like
-Xms128m -Xmx8192m -XX:PermSize=128m -XX:MaxPermSize=256m
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With