Eclipse:java.lang.OutOfMemoryError:Java堆空间

时间:2014-10-24 01:26:18

标签: eclipse fedora

我正在使用Eclipse 4.4.1,我总是遇到这个错误,我无法使用eclipse。

有没有办法解决它?

我的eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
2048m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XX:+UseParallelGC
-XX:PermSize=512M
-XX:MaxPermSize=2048m
-Xms512m
-Xmx2048m

异常堆栈跟踪:

java.lang.OutOfMemoryError: Java heap space
    at org.eclipse.ui.part.ResourceTransfer.nativeToJava(ResourceTransfer.java:162)
    at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:330)
    at org.eclipse.swt.dnd.Clipboard.getContents(Clipboard.java:241)
    at org.eclipse.ui.internal.navigator.resources.actions.PasteAction$1.run(PasteAction.java:192)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4590)
    at org.eclipse.ui.internal.navigator.resources.actions.PasteAction.updateSelection(PasteAction.java:186)
    at org.eclipse.ui.actions.BaseSelectionListenerAction.selectionChanged(BaseSelectionListenerAction.java:124)
    at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.updateActionBars(EditActionGroup.java:153)
    at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.fillActionBars(EditActionGroup.java:99)
    at org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider.fillActionBars(EditActionProvider.java:49)
    at org.eclipse.ui.navigator.NavigatorActionService$3.run(NavigatorActionService.java:259)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.navigator.NavigatorActionService.fillActionBars(NavigatorActionService.java:253)
    at org.eclipse.ui.navigator.CommonNavigatorManager.selectionChanged(CommonNavigatorManager.java:222)
    at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:163)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
    at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
    at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2171)
    at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1202)
    at org.eclipse.ui.navigator.CommonViewer.handleSelect(CommonViewer.java:478)
    at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1231)
    at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)
    at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:236)
    at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:408)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4454)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3799)

会话数据:

eclipse.buildId=4.4.1.M20140925-0400
java.version=1.7.0_71
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

2 个答案:

答案 0 :(得分:4)

我在安装https://extensions.gnome.org/extension/779/clipboard-indicator/后注意到了这种行为。你也安装了这个扩展吗?当我禁用此扩展(并重新启动gnome-shell)时,Eclipse中的异常消失了。你能证实一下吗?

我在这里做了一个错误报告:https://bugs.eclipse.org/bugs/show_bug.cgi?id=449902

答案 1 :(得分:1)

您不知道计算机上有多少内存,但您很可能指定了过大的内存要求。

检查这个优秀的答案:

根据您的设置,我相信您需要1GB的可用内存才能启动,如果加载大型项目,可能会使用更多内存。

如果这没有帮助,那么我也注意到异常发生在一个似乎与剪贴板传输相关的方法中。您的剪贴板中是否有可能包含非常大的数据集?这只是一个猜测,我不知道Eclipse为什么要在加载时从剪贴板传输数据。