java lang OutOfMemoryError PermGen space eclipse
Exception in thread “main” java.lang.OutOfMemoryError: PermGen space
- This is one of big annoying error in eclipse when you run the application and personally I don’t like it. You get exception as below:
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at quickfix.DefaultMessageFactory.addFactory(DefaultMessageFactory.java:85) at quickfix.DefaultMessageFactory.addFactory(DefaultMessageFactory.java:60) at quickfix.DefaultMessageFactory.<init>(DefaultMessageFactory.java:54) at com.wfs.otc.FixAcceptor.main(FixAcceptor.java:50)
- Solution: As see above we are getting this exception because it’s out of PermGen space particularly. You can increase PermGen space as below:
-XX:MaxPermSize=128M
To fix this error permanently please put below in your program VM argument:
-Xms512m -Xmx1024m -XX:MaxPermSize=128M
- For more information to increase memory in eclipse please visit this link