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

Contents added to a scene are not garbage collected when the contents of the scene are replaced/deleted

    XMLWordPrintable

    Details

      Description

      To display different tabs in an application, we want to replace the Nodes in a scene with new nodes. When we do this (as shown in the attached demo example) the nodes vanish in the UI but are still referenced by the Screengraph, so they do not get garbage collected. I investigated this with a profiler.

      You may even reproduce the bug with clicking > then 10 times on the "click me" button. You will receive an OutOfMemoryException.

      I added one example with VBox/HBox Layout and one with Grid Layout (jfxtras) showing the removal and regeneration of all entries on button click.

      I added one example that just deletes the nodes from the scene (you see in the Profiler that the SwingTextFields will not be garbage collected)

        Attachments

        1. HeapWalkerScreenShot.jpg
          HeapWalkerScreenShot.jpg
          250 kB
        2. MainDeleteNode.fx
          1 kB
        3. MainWithGridLayout.fx
          1 kB
        4. MainWithHLayout.fx
          1 kB
        5. MainWitNoLayout.fx
          2 kB
        6. Workaround_MainWithHLayout.fx
          5 kB

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              mjagerjfx Martin Jäger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: