-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
Consider this sample:
import org.eclipse.swt.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class LotsOfUSERObjects {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, SWT.NONE);
shell.open();
for (int i = 0; i < 5000; i++) {
browser.setText("Iteration " + i);
new BrowserFunction(browser, "name");
}
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}If you observe this with the Windows task manager (or Process Explorer) you will see there are 10,000 User Objects created, but they don't do anything as they clean up eventually.
The above is a minimal reproducer from a huge Eclipse application. Obviously the back to back setText calls are pointless, but across the huge application it was less obvious that they were redundant, and you can conceive of a design that isn't redundant too. As this sample goes to exactly (or would go past the Windows limit) if any other controls or windows are created at that point a SWTError: No more handles error is produced at that place.
PRs that fix this on the way.
Metadata
Metadata
Assignees
Labels
No labels