Sleak in RCP: Device is not tracking resource allocation

大憨熊 提交于 2019-12-01 02:28:27

问题


I have tried to make Sleak work on my Indigo RCP application. I have followed the steps on this guide. I.e. I have installed the plugin, added the swt tools plugin to current plugins, added the required plugins, modified the tracing options, and added the view in my application with folder.addView("org.eclipse.swt.tools.views.SleakView");

The view does indeed show up but I keep getting the error 'Device is not tracking resource allocation' when I try to use it.

I have tried the answers to older questions in stackoverflow on the matter, but had no luck

Sleak (SWT & RCP) : Device is not tracking resource allocation (eclipse 4.3)

Sleak SWT tool, Device is not tracking resource allocation

I have explicitly checked that the .options file loaded in the debug configuration does indeed have both the tracing options needed.

Any additional ideas?


回答1:


I think you haven't set these properties correctly:

org.eclipse.ui/debug=true
org.eclipse.ui/trace/graphics=true




回答2:


I faced the same problem recently, and managed to find a solution. Here's what I found, who knows it might help you.

On RCP startup, there's a call to PlatformUI.createDisplay(), which chains to a call to Workbench.createDisplay(). That's the exact point where the debug settings needed by Sleak are properly read and set.

What happened on our software was that a call to Display.getDefault() was made BEFORE the above call to PlatformUI.createDisplay(). It caused the creation of a new Display object, which was set as the default. This creation did not read and set the debug settings.

By the time our code got to the PlatformUI.createDisplay() call, it didn't actually create a new Display. Instead, it returned the previously-created, not-debug-friendly one. Thus leading Sleak into warning about "device not tracking resource allocation".

Adding a breakpoint at the method Display.register (Display display) helped us identifying the early creation origin and properly change it.



来源:https://stackoverflow.com/questions/33810556/sleak-in-rcp-device-is-not-tracking-resource-allocation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!