2011-04-13 43 views
1

根據客戶端,我正在研究一個神祕停止工作的舊RCP應用程序。經過很多挫折之後,我終於抓住了原始開發人員的電腦(一臺XP機器)。它在那臺電腦上運行良好,很好。SWT沒有更多的句柄 - 在Windows 7

所以我編譯它,並把它放在另一臺XP機器上,它運行良好。

在Windows 7機器上運行它,它顯示splashscreen,然後顯示關閉前一秒的主UI。

所以我複製該項目的Eclipse的工作環境到Windows 7的機器,和它給了我同樣的行爲,再加上錯誤信息:

org.eclipse.swt.SWTError: No more handles 

顯然,Sleak應該是答案對於內存泄漏,但它在整個程序死亡之前也只持續一秒鐘。我不認爲這是內存泄漏;啓動時僅打開兩個視圖。 Windows 7中是否有可能限制手柄的內容?

以下是完整的錯誤消息:

org.eclipse.swt.SWTError: No more handles 
at org.eclipse.swt.SWT.error(SWT.java:3803) 
at org.eclipse.swt.SWT.error(SWT.java:3695) 
at org.eclipse.swt.SWT.error(SWT.java:3666) 
at org.eclipse.swt.graphics.Image.<init>(Image.java:730) 
at org.eclipse.jface.resource.FileImageDescriptor.createImage(FileImageDescriptor.java:176) 
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:227) 
at org.eclipse.jface.resource.ImageDescriptor.createImage(ImageDescriptor.java:205) 
at org.eclipse.gef.ui.palette.editparts.PaletteEditPart$ImageCache.getImage(PaletteEditPart.java:396) 
at org.eclipse.gef.ui.palette.editparts.PaletteEditPart.setImageDescriptor(PaletteEditPart.java:353) 
at org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditPart.refreshVisuals(ToolEntryEditPart.java:455) 
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:676) 
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571) 
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235) 
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219) 
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198) 
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727) 
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677) 
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571) 
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235) 
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219) 
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198) 
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:727) 
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractEditPart.java:677) 
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh(AbstractGraphicalEditPart.java:571) 
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:235) 
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:219) 
at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:198) 
at org.eclipse.gef.editparts.SimpleRootEditPart.setContents(SimpleRootEditPart.java:101) 
at org.eclipse.gef.ui.palette.PaletteViewer.setPaletteRoot(PaletteViewer.java:397) 
at org.eclipse.gef.EditDomain.setPaletteViewer(EditDomain.java:360) 
at org.eclipse.gef.ui.palette.PaletteViewerProvider.hookPaletteViewer(PaletteViewerProvider.java:76) 
at org.eclipse.gef.ui.palette.PaletteViewerProvider.createPaletteViewer(PaletteViewerProvider.java:59) 
at org.eclipse.gef.ui.views.palette.PaletteViewerPage.createControl(PaletteViewerPage.java:63) 
at org.eclipse.gef.ui.views.palette.PaletteView.doCreatePage(PaletteView.java:100) 
at org.eclipse.ui.part.PageBookView.createPage(PageBookView.java:399) 
at org.eclipse.ui.part.PageBookView.partActivated(PageBookView.java:741) 
at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72) 
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) 
at org.eclipse.core.runtime.Platform.run(Platform.java:880) 
at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57) 
at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:70) 
at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:186) 
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:305) 
at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:56) 
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:126) 
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3491) 
at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:610) 
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2832) 
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729) 
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721) 
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673) 
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) 
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668) 
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652) 
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2635) 
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:708) 
at [companyname].gef.ApplicationWorkbenchWindowAdvisor.postWindowOpen(ApplicationWorkbenchWindowAdvisor.java:111) 
at org.eclipse.ui.internal.WorkbenchWindow.fireWindowOpened(WorkbenchWindow.java:1229) 
at org.eclipse.ui.internal.WorkbenchWindow.open(WorkbenchWindow.java:786) 
at org.eclipse.ui.internal.Workbench$22.runWithException(Workbench.java:1043) 
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31) 
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) 
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133) 
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425) 
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803) 
at org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1363) 
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31) 
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) 
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133) 
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800) 
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425) 
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2295) 
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200) 
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495) 
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) 
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490) 
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) 
at [companyname].gef.Application.start(Application.java:28) 
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) 
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:386) 
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:549) 
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) 
at org.eclipse.equinox.launcher.Main.run(Main.java:1236) 
at org.eclipse.equinox.launcher.Main.main(Main.java:1212) 
+0

你有沒有試過運行應用程序提升?它可能是一個權限問題,開發人員認爲「我不會得到這個文件的句柄的唯一方法是,如果我們不在他們身邊」 – 2011-04-13 06:21:10

+0

@Kate - 是的,我試着用管理員權限運行它,甚至試圖轉動一切都在控制面板的「安全」部分,只是爲了看看它是否有幫助。它沒有:( – bdares 2011-04-13 06:35:24

+0

你試過分析應用程序,例如使用Yourkit查看分配了多少個圖形對象? - 只是爲了排除可能的內存泄漏... – 2011-04-13 09:53:25

回答

1

如果事情能正常工作在Win XP和Win 7的不工作,則其潛在的SWT錯誤。我建議你在Eclipse bugzilla中引發一個bug。

1

我已經有過很多次了,這與處置資源有關。您可能正在創建Font,Image對象,並且不會通過顯式調用.dispose()來釋放它們。我懷疑它與Windows 7有關,它也會在那裏發生,但可能需要更長的時間才能發生,因爲您可能擁有該機器上的更多系統資源。確保您跟蹤和處理您分配的資源通常可以解決問題。

相關問題