|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.swt.util.Sleak
public class Sleak
Sleak is a simple tool that monitors SWT graphics resources. (Applications typically don't leak widget resources because of rule 2). You can use Sleak to detect leaks in SWT application code.
To use the tool, put the Sleak class on your class path and then find the place in your application code where you create the Display:
Display display = new Display();Before creating the display, create a DeviceData and set the data.tracking flag to true.
DeviceData data = new DeviceData(); data.tracking = true; Display display = new Display(data); Sleak sleak = new Sleak(); sleak.open();
Now run your code as usual. When the Sleak window comes up, it looks like this:
When you press the "Start" button, Sleak collects and displays a list of the SWT graphics resources that are currently allocated. At this point, perform the action in your application that you suspect is leaking. When you press the "Stop" button, Sleak displays the list of resources that were allocated since you pressed "Start". Select a resource in the list on the left and it will be drawn in the canvas on the right. Select the "Stack" checkbox to see a stack trace showing where the resource was created. This does not necessarily imply that this resource was leaked - just that it currently exists. If you believe that this particular resource is no longer needed and should have been disposed, then you have discovered a leak. Adopted from the SWT site: http://www.eclipse.org/articles/swt-design-2/sleak.htm
Constructor Summary | |
---|---|
Sleak()
|
|
Sleak(String title)
|
Method Summary | |
---|---|
static void |
main(String[] args)
|
void |
open()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Sleak()
public Sleak(String title)
Method Detail |
---|
public void open()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |