Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sleak in RCP: Device is not tracking resource allocation

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?

like image 987
Yampeku Avatar asked Nov 19 '15 17:11

Yampeku


2 Answers

I think you haven't set these properties correctly:

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

enter image description here

like image 164
Christophe Moine Avatar answered Sep 30 '22 23:09

Christophe Moine


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.

like image 22
Mario Marinato Avatar answered Sep 30 '22 23:09

Mario Marinato