Community
Participate
Working Groups
GEF uses double-buffered painting. At some point when painting to an offscreen Image, GDI objects (Pens in this case) are being leaked. Let me know if you need more information or a snippet.
Well... If you don't provide a snippet, the first thing they will do is write one. If you would rather they were working on the problem, it's better for you to write the snippet.
Randy, you did the research and used the MS tools as we discussed on the mailing list, didn't you? I stepped through a very simple "new Shell" example and couldn't see the leak. You absolutely need to provide a snippet or at least outline the steps and tools you used to come to this conclusion. Otherwise, we won't be able to do anything and will have to close this report as WORKSFORME. Thanks!
Here is what I have so far: 1) Go to eclipse.org/gef and click on downloads. 2) Unzip latest (I20031028) build onto M4. You need 2 ZIP files: runtime, and examples. 3) Delete the GEF and GEF.examples features, since they specify "2.1.2" of Eclipse 4) Launch Eclipse, File->New->Examples->GEF->Flow example. Click Next, Finish. 5) Start selecting nodes and containers and pressing the delete key. Delete a buch of stuff, undo what you deleted a few times, redo it, etc. Handle count grows. I'll see if there is a smaller scenario, but I need to prepare for a meeting at 3:00
To clarify, "delete features" means delete the feature folders. They are not required for running GEF, just the plugins themselves are needed.
The bug is dependent on calling GC.setLineWidth(1) on a GC created on an Image. If I remove this, it goes away.
public class Bug45640 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout()); final Button b1 = new Button(shell, 0); b1.setText ("Leak some pens"); b1.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Image image = new Image(null, 100, 100); GC gc = new GC(image); gc.setLineWidth(1); gc.dispose(); image.dispose(); } }); shell.setSize(400,300); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); } }
Foxed > 20031028.
The bug was only introduced in Eclipse 3.0. It is possible to check GDI leaks with the task manager on Xp.
Foxed? Good thing we never shipped this. Thanks again Randy!