注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

淡泊明智

 
 
 

日志

 
 

ECLIPSE java.lang.OutOfMemoryError: PermGen space 错误  

2012-11-16 11:51:20|  分类: JVM详解 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
博客分类:
jvm
EclipseJavaOSGIUISUN
ECLIPSE 最近一段时间经常报错,看了日志,有如下错误信息:
Java代码 复制代码 收藏代码ECLIPSE java.lang.OutOfMemoryError: PermGen space 错误 - 火木棉 - 淡泊明智
ENTRY org.eclipse.ui 4 0 2010-08-10 09:56:43.763  
!MESSAGE Unhandled event loop exception   
!STACK 0  
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: PermGen space)   
    at org.eclipse.swt.SWT.error(SWT.java:3884)   
    at org.eclipse.swt.SWT.error(SWT.java:3799)   
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)   
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)   
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)   
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)   
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)   
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)   
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)   
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)   
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)   
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)   
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)   
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)   
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)   
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)   
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)   
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)   
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)   
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   
    at java.lang.reflect.Method.invoke(Unknown Source)   
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)   
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)   
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)   
Caused by: java.lang.OutOfMemoryError: PermGen space   
    at java.lang.ClassLoader.defineClass1(Native Method)   
    at java.lang.ClassLoader.defineClassCond(Unknown Source)   
    at java.lang.ClassLoader.defineClass(Unknown Source)   
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:183)   
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:576)   
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:546)   
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:477)   
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:465)   
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:445)   
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)   
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)   
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:452)   
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)   
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)   
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)   
    at java.lang.ClassLoader.loadClass(Unknown Source)   
    at org.eclipse.ui.internal.navigator.NavigatorContentService.getExtension(NavigatorContentService.java:905)   
    at org.eclipse.ui.internal.navigator.NavigatorContentService.getExtension(NavigatorContentService.java:875)   
    at org.eclipse.ui.internal.navigator.NavigatorContentService.findRootContentExtensions(NavigatorContentService.java:511)   
    at org.eclipse.ui.internal.navigator.NavigatorContentService.findRootContentExtensions(NavigatorContentService.java:477)   
    at org.eclipse.ui.internal.navigator.NavigatorContentService.updateService(NavigatorContentService.java:380)   
    at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.inputChanged(NavigatorContentServiceContentProvider.java:598)   
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:270)   
    at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1634)   
    at org.eclipse.ui.navigator.CommonNavigator.createPartControl(CommonNavigator.java:191)   
    at org.eclipse.wst.server.ui.internal.cnf.ServersView2.createPartControl(ServersView2.java:66)   
    at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)   
    at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)   
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)   
    at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2228)   
    at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1067)   
    at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3816)  
ENTRY org.eclipse.ui 4 0 2010-08-10 09:56:43.763  !MESSAGE Unhandled event loop exception  !STACK 0  org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: PermGen space)   at org.eclipse.swt.SWT.error(SWT.java:3884)   at org.eclipse.swt.SWT.error(SWT.java:3799)   at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)   at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3855)   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)   at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   at java.lang.reflect.Method.invoke(Unknown Source)   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)   at org.eclipse.equinox.launcher.Main.run(Main.java:1311)  Caused by: java.lang.OutOfMemoryError: PermGen space   at java.lang.ClassLoader.defineClass1(Native Method)   at java.lang.ClassLoader.defineClassCond(Unknown Source)   at java.lang.ClassLoader.defineClass(Unknown Source)   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:183)   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:576)   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:546)   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:477)   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:465)   at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:445)   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:211)   at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:376)   at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:452)   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)   at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)   at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)   at java.lang.ClassLoader.loadClass(Unknown Source)   at org.eclipse.ui.internal.navigator.NavigatorContentService.getExtension(NavigatorContentService.java:905)   at org.eclipse.ui.internal.navigator.NavigatorContentService.getExtension(NavigatorContentService.java:875)   at org.eclipse.ui.internal.navigator.NavigatorContentService.findRootContentExtensions(NavigatorContentService.java:511)   at org.eclipse.ui.internal.navigator.NavigatorContentService.findRootContentExtensions(NavigatorContentService.java:477)   at org.eclipse.ui.internal.navigator.NavigatorContentService.updateService(NavigatorContentService.java:380)   at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.inputChanged(NavigatorContentServiceContentProvider.java:598)   at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:270)   at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1634)   at org.eclipse.ui.navigator.CommonNavigator.createPartControl(CommonNavigator.java:191)   at org.eclipse.wst.server.ui.internal.cnf.ServersView2.createPartControl(ServersView2.java:66)   at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:367)   at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)   at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)   at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2228)   at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1067)   at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3816)  

PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决方法也一定是加大内存。说说为什么会内存益出:这一部分用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和和存放Instance的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的APP会LOAD很多CLASS的话,就很可能出现PermGen space错误。这种错误常见在web服务器对JSP进行pre compile的时候。
改正方法,在 run.bat 中加入:-Xms256m -Xmx512m -XX:MaxNewSize=256m -XX:MaxPermSize=256m
因为项目中引用了很多的 jar 包,而这些 jar 包中的 class 信息会被 JBoss 的 class loader 加载到 PermGen space 区域,在 JVM 默认的情况下,该部分空间的大小只有 4M,在 jar 包非常多的情况下,显然是不够用的,所以通过 -XX:MaxPermSize=256m 指定最大值后即可解决问题。
另外,如果 heap 内存不足出现 java.lang.OutOfMemoryError: Java heap space 时,可以通过 -Xmx512m 指定最大 heap 内存来解决这样的问题。
解决问题的方式就是:修改了安装目录eclipse.ini文件,在最后面增加了两行
Java代码 复制代码 收藏代码ECLIPSE java.lang.OutOfMemoryError: PermGen space 错误 - 火木棉 - 淡泊明智
-XX:PermSize=128M    
-XX:MaxPermSize=128M  
-XX:PermSize=128M   -XX:MaxPermSize=128M  

这样就解决了问题。
  评论这张
 
阅读(528)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018