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

Adding a tooltip causes memory leak

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • javafx
    • EA build 25, Windows XP

      I've noticed that if I add a tooltip to an FX control and then trigger that tooltip at runtime (by hovering over it), it induces a memory leak which in my case is quite large because of the tooltipped control's parent reference. Attached is a sample application that will hopefully demonstrate the problem if you go through the following steps:

      - Run the app
      - Hover over the textbox and trigger the tooltip to appear
      - Click the button to remove the textbox from the scene. At this point there should be no remaining references to the textbox.
      - Garbage collection (hopefully) runs

      After going through this process, dump the heap and analyze it. You'll notice that the textbox is still in memory because of a reference chain similar to the one in the attached image from Eclipse MAT. This leak is potentially very serious because anything referenced by the parent of the textbox will be retained in memory. Note that if you skip the step where you hover on the control and trigger the tooltip popup, that the TextBox instance is not retained in memory.

            lnerad Ľubomír Nerád (Inactive)
            kmcintyrejfx Kyle McIntyre (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: