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

Animated GIFs cause memory leaks in javafx.scene.image.Image class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7u13
    • javafx

      When I use animated gifs in the Image class, the memory won't be released.

      Normal images work fine though.

      See example:


      import javafx.application.Application;
      import javafx.scene.image.Image;
      import javafx.stage.Stage;
       
      public class TestApp2 extends Application {
          public static void main(String[] args) {
              Application.launch();
          }
       
          @Override
          public void start(Stage stage) throws Exception {
       
              for (int i = 0; i < 10000; i++) {
                  new Image(getClass().getResourceAsStream("/animated.gif"));
              }
       
              System.gc();
              System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + " KB");
          }
      }

            jandrese Joe Andresen (Inactive)
            cschudtjfx Christian Schudt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: