JDK-8125636 : memory leak when recreating ImageView with a GIV image
  • Type: Bug
  • Component: javafx
  • Affected Version: 7u6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2012-08-28
  • Updated: 2022-10-21
  • Resolved: 2012-08-29
Related Reports
Duplicate :  
Description
An ImageView can contain an Image which uses a gif image. When the user clicks on a button, the application has to do some work and we switch the normal png image with a moving gif image.

Everytime we switch, we create the ImageView and the Image. This causes a memory leak.In visualVM, I see a lot of int[] which are not GC.

When I do not create the ImageView (and Image) but keep them as private attributes, there is no memory leak.

See attachment for project! It contains 1 class with 1 main method. It also contains 1 png and 1 gif. When the code on line 48 and 49 is uncommented, and the lines 56,57 commented, the memory bug is gone.

(So we have a very good workaround and now we always reuse ImageViews in application.)




Comments
This is duplicate of RT-19239. I did not found this one earlier... Just wanted to say we reuse Image and not ImageView to avoid the memory leak.
29-08-2012