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

Memory Leak using Gifs

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Fedora 27 x64, Java 8 x86 191, 192, 202
      Also tried 121 x64

      A DESCRIPTION OF THE PROBLEM :
      Tried to use 20mb gif file in ImageView.
      Result is terrible. My application is SWING app, but it uses JFXPanel for some parts of application. Everything is okay, memory usage less that 100mb.

      Image img = new Image("img.gif") - will produce memory leak. 20MB gifs will consume ~700Mb of ram.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      find giant gif file:
      https://media.giphy.com/media/oDVClSAzmbP6o/source.gif (3mb is enough)

      Create javafx Image object
      Use VisualVM or other tools to see how your memory is consumed.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      play gif
      ACTUAL -
      play gif sometimes, stuck, out of memory error

      ---------- BEGIN SOURCE ----------
      new Image(new FileInputStream(new File("source.gif")), width,
      height, true, true);
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don`t use gif. Use mp4 if your system will not crash.

      FREQUENCY : always


            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: