Community
Participate
Working Groups
Build Identifier: 3.7.1 On OS X 10.7.1, if TableColumn.pack() is called on a table which exists on a 'Tool' window then a memory leak occurs. The size of the memory leak is proportional to the area of the window. Reproducible: Always Steps to Reproduce: 1. Run the OS X Activity Monitor 2. Run the code snippet below 3. Click anywhere in the SWT window - this will show a new Tool window 4. Close the Tool window 5. In the Activity Monitor note the Real Mem value for the SWT process 6. Repeat steps 3 and 4 ten times 7. Again note the Real Mem value for the SWT process - it is about 80mb larger than in step 5. This indicates that the size of the memory leak is about 8mb each time the window is opened. Note that this problem only occurs if the Shell style includes TOOL and the method pack() is called on the TableColumn. ---------------- code snippet ------------------ import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; public class TestMemoryLeak { public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.addMouseListener(new MouseAdapter() { Shell topShell = null; @Override public void mouseDown(MouseEvent e) { if (topShell != null) { topShell.dispose(); } topShell = new Shell(shell, SWT.DIALOG_TRIM | SWT.TOOL); topShell.setSize(2000, 1000); topShell.open(); topShell.setText("Tools"); Table table = new Table(topShell, SWT.BORDER); table.setHeaderVisible(true); table.setBounds(20, 20, 100, 100); TableColumn col = new TableColumn(table, SWT.LEFT); col.setText("Tooly Dooly"); col.setWidth(30); col.pack(); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
This is same as Bug 338975, and has been fixed in 3.7.2 & 3.8. *** This bug has been marked as a duplicate of bug 338975 ***