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

Memory leak - com.sun.javafx.scene.control.WeakListChangeListener does not implement WeakListener


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 7u45
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      Oracle JDK 1.7.51


      There is a class called com.sun.javafx.scene.control.WeakListChangeListener (note, this is different from the common javafx.collections.WeakListChangeListener), which is used internally in JFX some components. This class only has the word "weak" in its name, and a weak reference inside, but it does not implement the interface javafx.beans.WeakListener. Hence it is not treated as a weak listener by the runtime, it is never removed from the listener lists.

      I came across it when working with TableView. It seems that every table cell registers a listener to TableView.visibleLeafColumns. When the table is big, and there are frequent changes, then there are eventually millions of these WeakListChangeListeners hanging on the columns list. The weak references are empty, but the listeners are never removed from the list because they do not implement the WeakListener interface. And this leak becomes a major memory consumer (hundreds of megabytes) in our application. In addition, when we attempt to show/hide a column then, the table must iterate through the millions of listeners and the application freezes for tens of seconds.

      Is there any possibility to get it fixed in Java 7? We can not migrate to Java 8 yet, and it is really causing serious troubles.




            • Assignee:
              msladecek Martin Sládeček
              jmarekjfx Jan Marek (Inactive)
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: