-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
7u13
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");
}
}
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");
}
}
- duplicates
-
JDK-8117172 Memory leak with Animated images
-
- Closed
-