JDK-8128496 : Possible leak while playing video in a loop using JavaFX 2
  • Type: Bug
  • Component: javafx
  • Sub-Component: media
  • Affected Version: fx2.0.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-11-09
  • Updated: 2022-10-21
  • Resolved: 2013-07-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Relates :  
Relates :  
Description
Hi,
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
Comments
This issue was resolved as part of RT-28817.
03-07-2013

Any progress on resolving the problem? It's been around for quite some time now ...
07-06-2013

I have this same occurance. However I use rather large video files, and have had it crash my system (BSOD). After running it for 2 hours+ with videos in a loop the java platform binary crashes, and sometimes I've come back to the computer saying "Windows has recovered from an unexpected shutdown"
29-01-2013

Is there any indication when we can expect a fix for this bug?
23-01-2013

Multiple users have been complaining about Media memory leaks on JavaFX forums: https://forums.oracle.com/forums/thread.jspa?threadID=2472430
08-01-2013

There is no work around for now.
12-06-2012

Is there any way around this? The issue has not been fixed in 2.1. I didn't try 2.2 but according to RT-21050 the bug still persists there as well. Is there a workaround how to dispose the leaking objects other that rerunning the entire application?
12-06-2012

Exactly. The problem occurs after a longer period of time. Any clue what's causing the problem / leak ? Thanks
07-12-2011

No, only after running for 5 hours or so.
06-12-2011

Does this problem occur when you also try to run the program? Thanks
06-12-2011

The stopping of the MediaPlayer-instance as in the resolved RT 17199 doesn't solve the leak in this case.
16-11-2011

I've run the application one more time with the Vm options "-Xms2m -Xmx32m -verbose:gc" to throw some more light on what happens during the GC runs. The attached file ("console_output.txt") is the output from the application with some outputs from the GC. The application died (== was still running but didn't execute the main thread anymore and one video frame stood still and no exception has been thrown) after playing the video 755 times in a loop
16-11-2011