Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8094811

Scene and scenegraph leak when the Stage is closed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      Mac OS X.

      Description

      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);
      }

        Attachments

        1. HelloJFXPanelLeakTest.java
          4 kB
        2. oldFocusOwner-ref.png
          oldFocusOwner-ref.png
          82 kB
        3. scene-ref.png
          scene-ref.png
          63 kB
        4. SceneTest.zip
          42 kB

          Issue Links

            Activity

              People

              Assignee:
              ckyang Chien Yang (Inactive)
              Reporter:
              jfdenise Jean-Francois Denise (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: