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

JavaFX - memory leak after the event WindowEvent.DESTROY

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      A DESCRIPTION OF THE PROBLEM :
      Explanation:
      The most relevant class for this issue is com.sun.javafx.tk.quantum.StageWindow.
      When the bug happens, a StageWindow gets registered in the static HashMap platformWindows but newer get's removed.
      Usually, the HashMaps gets cleared, when StageWindow.closed is called.
      But when StageWindow.setPlatformWindowClosed gets called, which only happens on a WindowEvent.DESTROY,
      then the reference platfromWindow get nulled, but the hashmap platformWindows never gets cleaned up.


      Solution:
      StageWindow.setPlatformWindowClosed must be changed, to cleanup platformWindows.
      This change shouldn't cause any problems, because platformWindows is only used in PaintCollecter.
      This usage contains a null-check and not rendering the destroyed window shouldn't have any effect.
      I will provide a pull request for it when the bug is in the bug tracker.

      REGRESSION : Last worked in version 8u181

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Reproduce:
      The bug can be reproduced, by creating a WindowEvent.DESTROY event, but I don't know how to create such an event.

      I found the memory leak inside a heap dump from a server running JPro (https://jpro.one).
      After 600 opened Stages, the memory leak happened twice.

      It's save to assume that this bug also happens on the desktop.
      It might happen much more often on a specific OS or applications.


      FREQUENCY : rarely


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: