Monitoring SWT Graphics Resources with Sleak
Version 4.1.1 of Spoon and later now includes Sleak. Sleak is a tool that monitors SWT graphics resources. More information can be found at http://www.eclipse.org/articles/swt-design-2/sleak.htm.
To use Sleak pass the VM argument SLEAK when starting Spoon. For example, in Linux modify the spoon.sh script and add -DSLEAK to the OPT variable:
OPT="$OPT -Xmx256m -Xms256m -XX:MaxPermSize=128m -DSLEAK -Djava.library.path=$LIBPATH . . . .
This is an example of using Sleak:
- Start Spoon with the SLEAK VM argument.
- Click the "Snap" button on the Sleak dialog. A snapshot of allocated SWT resources is taken.
- Open a dialog is Spoon, such as the Repository Explorer.Â
- Close the dialog.Â
- Click the "Diff" button. There should be no differences in allocated resources since the snapshot.