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

Possibility to have unbindAll() for Binding classes?

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • fx2.1
    • javafx
    • Windows 7 32-bit JavaFX 2.1

      I've spent a few days and a weekend debugging a most odd problem, going so far to post on the hotspot gc mailinglist about a possible problem with the garbage collector (as it was filling my log with hundreds of lines without making any headway in cleaning up the garbage). It turns out the root of the problem was this innocent looking line in a StringBinding's onInvalidating method:

      unbind(getDependencies());

      It causes problems because it doesn't do anything at all -- this compiles fine because getDependencies() is an Observable and thus a valid (single) parameter for the Observable varargs parameter in unbind (that was my first mistake). My second mistake here is thinking that getDependencies would return my registered dependencies that cause this binding to be invalidated -- it just returns an empty list (as documented I discovered).

      However, after adding more and more binding dependecies without unbinding anything at all, after 10 to 15 of those the JVM goes completely crazy showing hundreds of GC lines futily trying to clean up ...something(?) -- which of course gets worse and worse when more and more of these bindings get added resulting in CPU being maxed out and everything being unresponsive -- and of course all kinds of wrong suspicions as to what might be holding on to all that memory. See this post for the example code that is causing this problem: https://forums.oracle.com/forums/thread.jspa?threadID=2346557&tstart=0

      So, I was wondering, if it would be possible to provide an easy way to get rid of all the bindings :-)

            mheinrichs Michael Heinrichs (Inactive)
            jhendrikx John Hendrikx
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: