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

[AppModel] Garbage Collection noticeably pauses the JavaFX Application Thread



    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8, 8u5, 8u20
    • Fix Version/s: 9
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows 8.1 Java


      I've noticed over the past year that the JavaFX Application thread seems to experience a very noticeable "stutter" or lag when Garbage Collection runs on my application. Could this be fixed if the thread priorities between the GC thread and the JavaFX Application thread were tuned a bit differently?


      What do I mean when I say the App thread "stutters"? I mean I'll be dragging a scrollbar or some other node with the mouse, and suddenly the app goes unresponsive for about a half-second. Nothing updates visually, and the dragged node stops moving and then it suddenly 'leaps' forward to catch up with the mouse cursor. Similiarly, if I am typing when the GC happens, one or two typed letters don't appear for a second, and then suddenly they appear all at once as the app thread 'catches up'.

      Here's how I recognize the problem:

      1) I'm working on a large 12 year old desktop app, written in Swing. We recently ported it over to 100% JavaFX.

      2) Back in Swing, the Event Dispatch thread always seemed to run smoothly; Garbage Collection never caused any 'stuttering' that I can recall. But in JavaFX, I see the 'stutter' at least once every time I use our app. This has been going on since early Lombard builds.

      3) We print a line to the console output whenever Garbage collection runs. That means I know for sure that Garbage Collection ran in Swing without causing stuttering, and I also know for sure that when I see the stuttering in JavaFX, GC is happening at the same time. Also, I know that the JavaFX version of our app doesn't perform GC much more often than the Swing version did.

      I actually use two development computers; one is significantly faster than the other. On the faster machine, I don't see this stuttering problem very often (maybe not at all), but it happens all the time on the slower machine.




            kcr Kevin Rushforth
            cbanackjfx Cory Banack (Inactive)
            0 Vote for this issue
            3 Start watching this issue