MMAPI BasicPlayer Leak
I wanted to get some wider opinion on something I noticed not too long
Something I noticed while I was reading the recently released phoneme
mr1 source code is that there is a private static hashtable field in the
com.sun.mmedia.BasicPlayer class called mplayers. It seems that once you
create a Player it will be added to that hash table with a unique id
(from a hardcoded pool of 32768 ids) and it won't be released from the
hash table until you call the close() method.
A long time ago I used to play sounds literally using the most basic
implementation imaginable, just see the Player Javadocs and look for the
"Simple Playback Example". If what I am reading in BasicPlayer class is
true for actual devices this example would result in a memory leak.
Has anyone else noticed this issue? It seems like the Javadocs are
silent on the issue. Their simple example would cause a lot of
developers to end up leaking memory and they never explicitly explain
that you must close a Player or it will never be garbage collected (well
at least until you happen to make 32768 Players). Seems like the
Javadocs should mention this somewhere unless I am off in my analysis of
the BasicPlayer class.
To unsubscribe, send email to firstname.lastname@example.org and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
email@example.com and include in the body of the message "help".