0
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.catalina.util.CustomObjectInputStream.resolveClass(CustomObjectInputStream.java:76)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    at java.util.ArrayList.readObject(ArrayList.java:593)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:969)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1595)
    at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1060)

This error I got every time in my web application when i am doing runtime read and write operation on properties file multiple times e.g 15 times.

I had done this solutions like increasing tomcat memory space.But it is not working at all.I want best Soltion rather than increasing space.I have allocated memory space for tomcat at about 1024 kb. This solution is NOT working -XX:MaxPermSize=SIZE


I want solution like how to stop JVM from storing String Literals in PerGen heap.I think it will avoid this type of error.

Donato Szilagyi
  • 4,279
  • 4
  • 36
  • 53
Oomph Fortuity
  • 5,710
  • 10
  • 44
  • 89
  • 2
    Allocate more permgen? The default is pretty small for a lot of web app architectures – Affe Jan 17 '13 at 07:05
  • I thing this problem is occurring due to multiple read write operation on properties file. – Oomph Fortuity Jan 17 '13 at 07:10
  • Check here - http://stackoverflow.com/questions/3003855/increase-permgen-space – titogeo Jan 17 '13 at 07:14
  • I had already tried that solution from stackoverflow.com/questions/3003855/increase-permgen-space.It is not working. – Oomph Fortuity Jan 17 '13 at 07:25
  • 1
    You set permsize to 1024 **k**b? confused – Affe Jan 17 '13 at 07:34
  • 1
    The solution is usually one of 3 things (and usually a combination of all 3): 1) Increase PermGen, 2) Decrease object instantiation/destruction, and 3) Fiddle with the GC settings. For #2, things like concatinating Strings can cause problems...use StringBuilder instead. Or make sure you add finalize methods to your own class that nullifies references. Turn up GC logging and/or use some of the free JMX tools to analze the JVM while it's running or the logs after the fact. There are loads of resources out there explaining how to tune memory and GC. – CodeChimp Jan 18 '13 at 20:28

0 Answers0