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

Scene graph elements are not garbage collected (Memory Leak)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7u6
    • javafx
    • None

      If you use the Loader.load method to load a new scene you will get multiple instances of all of the controllers.

      For example in the FXML-LoginDemo Application from http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html#sb (Attached) there is a method in the Main class called replaceSceneContent. If you monitor this application with JVisualVM and login multiple times you will see the number of instances of each controller increase each time.

      I believe the old instances of the controllers will no longer be accessible yet also they wont be garbage collected.

        1. FXML-LoginDemo.zip
          152 kB
        2. FxBugs.java
          3 kB
        3. caret_gc_fix.diff
          4 kB

            jgiles Jonathan Giles
            duke J. Duke
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: