Eclipse:java.lang.OutOfMemoryError: PermGen space

2019-02-16 01:57发布

问题:

My eclipse configuration.

Eclipse : latest version (Kepler)

My eclipse config.ini

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130521-0416
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40M
-Xmx512M

After Updation From to Juno to Kepler.But with the same configuration I did'nt face any issue.

Exception I'm facing is

Caused by: java.lang.OutOfMemoryError: PermGen space
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
    at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
    at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at net.sf.beanlib.provider.BeanPopulator.invokeMethodAsPrivileged(BeanPopulator.java:221)
    at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:194)
    at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172)
    at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174)
    at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173)
    at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:67)
    at net.sf.beanlib.hibernate3.Hibernate3CollectionReplicator.replicate(Hibernate3CollectionReplicator.java:143)
    at net.sf.beanlib.provider.replicator.CollectionReplicator.replicateCollection(CollectionReplicator.java:88)
    at net.sf.beanlib.hibernate3.Hibernate3CollectionReplicator.replicateCollection(Hibernate3CollectionReplicator.java:79)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:101)
    at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224)
    at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:201)
    at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172)
    at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174)
    at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173)
    at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
    at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
      [ERROR] Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)

It's keep telling me

[ERROR] Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)

Here is my VM args

What could be the issue..

Thanks for any help.

回答1:

From Eclipse wiki-

Why am I getting a java.lang.OutOfMemoryError: PermGen space?

The default maximum Permanent Generation space set by your JRE may be too small. This is unrelated to the maximum allowed Heap space. You can increase the maximum PermGen size by launching Eclipse with the VM argument: -XX:MaxPermSize=128m



回答2:

Increase -vmargs to 512 & 1024 in eclipse.ini & close the eclipse & open it again.

Hopefully it will solve the issue.



回答3:

This problem might also be due to there being too many apps in the launch list when you Run As ... Run on Server in eclipse.

To find out of this is the cause of the problem, you can just click Next to see the list of apps that will be launched, instead of rushing through to click Finish.

If you see other apps besides the one you want to launch, just remove all the unwanted apps so that only your app is selected, and then click Finish. This will require much less memory and thus not require you to jack up the PermGen space.