Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.OutOfMemoryError: PermGen space [closed]

I am getting following error frequently in eclipse IDE 3.2, how could I save the application from these OutOfMemory?

java.lang.OutOfMemoryError: PermGen space     java.lang.ClassLoader.defineClass1(Native Method)     java.lang.ClassLoader.defineClassCond(Unknown Source)     java.lang.ClassLoader.defineClass(Unknown Source)     java.security.SecureClassLoader.defineClass(Unknown Source)     org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1814)     org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)     org.jboss.web.tomcat.service.WebAppClassLoader.findClass(WebAppClassLoader.java:75)     org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)     org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)     com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)     java.sql.DriverManager.getConnection(Unknown Source)     java.sql.DriverManager.getConnection(Unknown Source)     org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)     org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)     org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)     org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)     com.mfic.util.HibernateUtil.<clinit>(HibernateUtil.java:16)     com.mfic.dao.BaseHome.getSession(BaseHome.java:16)     com.mfic.core.helper.UserManager.findByUserId(UserManager.java:248)     com.mfic.core.action.Login.authenticate(Login.java:39)     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     java.lang.reflect.Method.invoke(Unknown Source)     com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)     com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)     com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)     com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)     org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) 
like image 660
Ganesamoorthy Avatar asked Sep 18 '10 23:09

Ganesamoorthy


People also ask

How do I fix Java Lang OutOfMemoryError PermGen space?

OutOfMemoryError: PermGen space. As explained in the above paragraph this OutOfMemory error in java comes when the Permanent generation of heap is filled up. To fix this OutOfMemoryError in Java, you need to increase the heap size of the Perm space by using the JVM option "-XX: MaxPermSize".

How do I increase my PermGen space?

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. In the next step, we will show you how to set the VM options in Tomcat, under Windows and Linux environment.

What is PermGen space in Java?

lang. 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.


1 Answers

If you are getting the questioned error in the secondary Eclipse Application, adding -XX:MaxPermSize=512m in ini won't help. You need to go into debug or run configuration->arguments and add that piece in VM arguments.I also increased others memory limits so:

-Dosgi.requiredJavaVersion=1.5 -Xms120m -Xmx2048m -XX:MaxPermSize=1024m 

It helped.

Edit. After some experiments I've found, that Eclipse does take memory limits from the ini file. But... it does it only once, at the creation of a new workspace. Parameters from -vmarg in eclipse.ini create the default VM parameters line. So, if you are working on the existing workspace, change debug or run configuration. But change eclipse.ini, too, for better future.

like image 63
Gangnus Avatar answered Sep 24 '22 00:09

Gangnus