I am in a context where I start a Stage from an eclipse platform. The stage is closed (using the Window Manager close cross button). An heapdump of the eclipse platform shows that a reference is kept on the Scene although the Stage has been closed.
I have attached a screenshot of VisualVM showing the nearest GC root for the scene (scene-ref.png).
If multiple Stages are opened and closed, there is a single Scene reference that is kept.
I have tried to replace the scene root with an empty container to avoid my scenegraph to stay in memory but for some reasons, a reference is kept to my scenegraph from the Scene.oldFocusListener. I attached the nearest GC root of an object inside my scenegraph (oldFocusOwner.png).
Should we consider this situation as a Leak? Any way to make the Scene to not reference the scene graph?
The code to start the stage:
Shell junk = new Shell();
new FXCanvas(junk, SWT.NONE);
junk.dispose();
try {
Stage stage = new Stage();
JMCContext ctx = new JMCContext(stage);
Main.init(ctx);
ctx.getMainController().selectClasses();
stage.setTitle(ctx.getTitle());
stage.setScene(ctx.getScene());
ctx.getStage().show();
} catch (Exception e) {
throw new RuntimeException(e);
}
I have attached a screenshot of VisualVM showing the nearest GC root for the scene (scene-ref.png).
If multiple Stages are opened and closed, there is a single Scene reference that is kept.
I have tried to replace the scene root with an empty container to avoid my scenegraph to stay in memory but for some reasons, a reference is kept to my scenegraph from the Scene.oldFocusListener. I attached the nearest GC root of an object inside my scenegraph (oldFocusOwner.png).
Should we consider this situation as a Leak? Any way to make the Scene to not reference the scene graph?
The code to start the stage:
Shell junk = new Shell();
new FXCanvas(junk, SWT.NONE);
junk.dispose();
try {
Stage stage = new Stage();
JMCContext ctx = new JMCContext(stage);
Main.init(ctx);
ctx.getMainController().selectClasses();
stage.setTitle(ctx.getTitle());
stage.setScene(ctx.getScene());
ctx.getStage().show();
} catch (Exception e) {
throw new RuntimeException(e);
}
- relates to
-
JDK-8088972 MacView instances are not garbage collected due references to ES2/Prism
- Closed