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

Possible leak while playing video in a loop using JavaFX 2



    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • fx2.0.1
    • javafx
    • Windows 7 64bit (but i had the same problems on Win XP SP3), javafx 2.0.1, java 1.7.0_01-b08


      I have found a possible memory leak while playing a video in a loop. The attached java file is a sample code which demonstrates this behaviour.

      The application puts a MediaView instance on the stage and assigns a MediaPlayer instance to it. The MediaPlayer instance plays a local copy of some default oracle video file (i've used this one for this purpose: http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv) encoded as VP6. A new MediaPlayer instance is created and assigned to the MediaView each time an EndOfMedia - event occurs. I'm setting the playback rate to 100.0 to achieve more cycles in a shorter time. The VM arguments for the run are "-Xms2m -Xmx32m" (I have also tried it without them which basically took just more time to get to the same result).

      This code performs the same as in the previous version of JavaFX which means that after an hour or two a one video frame stands still. Also if i use the built-in profiler in Netbeans, all the activity (allocation and garbage collection) stays at the same level. The "Live Profiling Results" window shows that the number of Live Objects of type "com.sun.media.jfxmediaimpl.NativeMediaPlayer" increases over time, but it doesn't happen 1-to-1 with each iteration of the player. The number of Live NativeMediaPlayer instances is the same as the number of generations of GC.

      Thanks a lot


        Issue Links



              almatvee Alexander Matveev
              pmihalikjfx Peter Mihalik (Inactive)
              2 Vote for this issue
              4 Start watching this issue