audio - Memory leak while playing sounds with java -


this code playing sounds:

public class sound {     public static void playsound(string path)     {       try        {            clip clip = audiosystem.getclip();            audioinputstream inputstream = audiosystem.getaudioinputstream(new file(path));            clip.open(inputstream);            inputstream.close();            clip.start();          } catch (exception e) {            e.printstacktrace();         }                    } } 

if call sound.playsound("xxx.wav"); many times see ram according task manager starts rise dramatically. how clean up?

try close method. javadoc:

void close() closes line, indicating system resources in use line can released. if operation succeeds, line marked closed , close event dispatched line's listeners.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -