0 Replies Latest reply on Mar 1, 2013 1:35 PM by csh

    Memory Leaks when using Animated GIFs in Image class


      I noticed that there are memory leaks, when using animated GIFs in the JavaFX Image class.
      Appearently it does not free the image and each image, which is loaded remains in memory.

      Is this a known issue? Is there a workaround?

      Consider the following 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) {
          public void start(Stage stage) throws Exception {
              for (int i = 0; i < 10000; i++) {
                  new Image(getClass().getResourceAsStream("/animated.gif"));
              System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + " KB");