-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Describe the bug
SWT on GTK4 does not dispose the native resources allocated by the Shell.
To Reproduce
Run the below example with a process monitor running
package org.eclipse.swt.snippets;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.widgets.*;
public class Snippet1 {
public static void main(String[] args) {
System.out.println("GTK4: " + GTK.GTK4);
int i = 0;
while (i++ < 2500000) {
System.out.println(i);
final Display display = new Display();
Shell shell = new Shell(display);
shell.open(); // only needed on wayland
while (display.readAndDispatch()) {
}
display.dispose();
System.gc();
}
}
}Expected behavior
No memory or thread growth after first few iterations - the GTK3 version achieves this.
Screenshots
(apologies for the picture of my screen, while tests were running I couldn't get screenshots working)
Image shows, the following java processes. The snippet above was running for about 3 minutes, or about 600 iterations.
- My IDE
- GTK4 x11 of above snippet
- GTK3 x11 of above snippet
- GTK4 wayland of above snippet
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
- Additional OS info (e.g. OS version, Linux Desktop, etc)
Ubuntu 25.10
In addition to the obvious problem of a memory leak, this is one of the blockers for getting #2714 complete because the test java process keeps running out of memory and the GitHub runner gets killed for trying to allocate too much memory.
