15

我遇到了 Eclipse 经常对我发脾气(并且通常很迟钝)的问题,我想知道是否有人可以给我任何见解。抛出的消息是“无法创建新的本机线程”。此时会提示我重新启动 Eclipse。这种情况每天发生 5 次左右。

我正在使用 Ecliipse Helios Service Release 2(带有 Flash Builder 插件):

Windows Vista Business
Processor: Intel Core 2 Duo T7500 @ 2.20 GHz
Memory (RAM): 4.00 GB
System Type: 32-bit Operating System

我的 eclipse.ini 设置是从这个线程中偷来的: eclipse 的最佳 jvm 设置是什么

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
-vm
C:/jdk1.6.0_25/jre/bin/client/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Declipse.p2.unsignedPolicy=allow
-Xmn256m
-Xms1024m
-Xmx1024m
-Xss4m
-XX:PermSize=256m
-XX:MaxPermSize=256m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-Dcom.sun.management.jmxremote

谢谢你的帮助!

编辑:

@normalocity - 错误刚刚发生(未处理的事件循环异常),这是在调整我的 eclipse.ini 之后(我将 Xss 更改为 1m,MaxPermSize 更改为 384m,Xms 更改为 512)。这是您要求的其他信息,异常堆栈跟踪:

java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:640)
at org.eclipse.jface.text.contentassist.ContentAssistant$AutoAssistListener.start(ContentAssistant.java:263)
at org.eclipse.jface.text.contentassist.ContentAssistant$AutoAssistListener.keyPressed(ContentAssistant.java:345)
at com.adobe.flexide.editorcore.contentassist.FlexContentAssistant$FlexAutoAssistListener.keyPressed(FlexContentAssistant.java:47)
at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:811)
at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:489)
at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:65)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5957)
at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5656)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4270)
at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4162)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
4

2 回答 2

16

新线程堆栈似乎没有足够的内存。在 Windows 上,进程空间为2GB。对于堆,您最初分配 1Gb(-Xms 选项),因此它从一开始就被锁定。减去 256Mb 的类(PermSize),减去 JVM 开销,可能高达 0.5Gb。因此,您的线程只有大约 256Mb 的堆栈空间,即最多 64 个线程 (256/4m)。

解决方案:尝试将堆栈大小降低到 -Xss1024k 或减小初始堆大小 (-Xms)

OutOfMemory相关阅读:无法创建线程

作为旁注,-XX:MaxPermSize=256m 对于 EE 的 Eclipse 来说看起来太小了。最好设置为 384。

干杯,马克斯

于 2011-07-20T07:11:12.277 回答
0

我在 Fedora 20 上也遇到了 Eclipse Luna 的问题。我已经阅读了很多关于不同内存选项的内容,但仍然无法找出问题所在。它把我逼疯了。

最后我意识到,默认情况下,普通用户在 Fedora 上可以拥有的进程数量是非常有限的。limits.d/90-nproc.conf 的内容:

*          soft    nproc     1000

将此提高到 5000 修复了我的“无法创建新的本机线程”问题。

于 2014-10-08T09:31:56.263 回答