[API Review]: RT-28817 - Add explicit dispose() method to MediaPlayer

Alexander Matveev alexander.matveev at oracle.com
Wed Mar 6 15:07:16 PST 2013

Hi all,

Explicit dispose() method is needed to free native resources used by 
MediaPlayer. Garbage collector is not reliable enough to free native 
resources fast enough, thus when MediaPlayers are created fast enough we 
may run out of native memory. Normally, user does not need to call 
dispose() method on MediaPlayer if application does not create them 
often. After dispose() is called MediaPlayer cannot be used again and 
should be disregarded. Media and MediaView associated with disposed 
MediaPlayer can be reused. Dispose() will be valid in any states. For 
example, when player is playing call to dispose() will stop playback and 
release all resources.



More information about the openjfx-dev mailing list