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

[CSS] Memory leak in stylesheet handling


    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 7u45
    • Fix Version/s: 7u60
    • Component/s: javafx
    • Environment:

      win7, java 1.7.0_45, javafx 2.2.45-b18


      I have a real world application that shows a flow of images decorated with some labels. New images are loaded every minute or so and the application should be able to run for several days or weeks.

      After customers reported that the application crashes with an OutOfMemoryError I have done some profiling and discovered that the application has a memory leak in the javafx StyleManager class. It seems to be related to the way that stylesheets are applied to GUI components in the application. If a stylesheet is applied in a component that is created over and over again then more and more memory is used in the StyleManager and even though the component itself is removed from the scene memory is never released from the StyleManager.

      I have created a simple test-application that gets an OutOfMemoryError after a few minutes when run with -Xmx32m.

      I will try to attach the code.

      Output from my test-application:

      javafx.runtime.version: 2.2.45-b18
      java.lang.OutOfMemoryError: GC overhead limit exceeded
      at com.sun.javafx.css.StyleHelper.calculateValue(StyleHelper.java:1459)
      at com.sun.javafx.css.StyleHelper.lookupFont(StyleHelper.java:1999)
      at com.sun.javafx.css.StyleHelper.lookup(StyleHelper.java:1017)
      at com.sun.javafx.css.StyleHelper.transitionToState(StyleHelper.java:863)
      at javafx.scene.Node.impl_processCSS(Node.java:7419)




            • Assignee:
              dgrieve David Grieve
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              6 Start watching this issue


              • Created: