12

i'm getting the following error "http-9000-5" java.lang.OutOfMemoryError: PermGen space

org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception java.lang.OutOfMemoryError: PermGen space.

My application using axis2.I increased the heap size 1024mb.But its not working.What would be the problem.Solution please

jmj
  • 237,923
  • 42
  • 401
  • 438
jayavardhan
  • 587
  • 5
  • 9
  • 19
  • 1
    possible duplicate of [How to deal with "java.lang.OutOfMemoryError: PermGen space" error](http://stackoverflow.com/questions/88235/how-to-deal-with-java-lang-outofmemoryerror-permgen-space-error) – Joachim Sauer Jan 28 '11 at 11:26

5 Answers5

16

PermGen and heap size are different from each other.

You need to increase permgen space like this:

-XX:PermSize=256m 
-XX:MaxPermSize=256m

add this flags.

Also look at this: explaining-java-lang-outofmemoryerror-permgen-space and this: how-to-deal-with-java-lang-outofmemoryerror-permgen-space-error

Hope this helps.

Community
  • 1
  • 1
Harry Joy
  • 58,650
  • 30
  • 162
  • 207
  • These options are explained a bit here: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html#PerformanceTuning – amos Feb 13 '14 at 18:29
15

you need to set something in your tomcat argument

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

Note:XX:MaxPermSize=256m

jmj
  • 237,923
  • 42
  • 401
  • 438
  • 5
    Remember to put this in a `setenv` script in your tomcat/bin/ directory. For *nix use a `setenv.sh` script with `export JAVA_OPTS="......"` and for Windows use a `setenv.bat` script with `set JAVA_OPTS=.....`. – Qwerky Jan 28 '11 at 11:24
6

If you're using Tomcat as a Server of Eclipse, go to Server view, then double click on Tomcat, then "Open Launch Configuration", go to Arguments tab, and after setting -Dcatalina.base="" put this

-Xms256m -Xmx512m -XX:MaxPermSize=512m -XX:PermSize=128m
Alessio
  • 2,018
  • 25
  • 26
2

In addition to raising the PermGen size, try enabling permgen garbage collection with

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
werkshy
  • 1,605
  • 1
  • 13
  • 22
0

Try increasing the ram allocation for your JVM. It should help.

Fix for eclipse: You can configure this in eclipse preference as follows

Windows -> Preferences ( on mac its: eclipse ->preferences) Java -> Installed JREs Select the JRE and click on Edit on the default VM arguments field type in --Xms256m -Xmx512m -XX:MaxPermSize=512m -XX:PermSize=128m. (or your memory preference,for 1 gb of ram its 1024) Click on finish or OK.

Manjush
  • 494
  • 5
  • 14