Hi elamre -
Your use of the Clip is kind of goofy, but I made the same mistake as do lots of other people. The "normal" way to use a Clip is to load it ONLY ONCE, and if you play multiple times, setFramePosition() or setMicrosecondPosition() back at the start of the audio. If you reload it and close it every time you play it, you might as well use a SourceDataLine as it starts quicker. A Clip won't play until the entire sound file has been loaded into memory.http://docs.oracle.com/javase/tutorial/sound/playing.html
-- see the section on Clip.
Who knows what Microsoft does when asked to do all those Clip reloads. I don't. But I could see that thrashing as maybe causing the TaskManager to show some bloating.
Another thing, a bit of example code on the same tutorial, down a couple paragraphs, gives a last step of setting the line to null to release it, but you don't do this. I don't know for sure how necessary this is, but it is a step that I always include.
BTW, just a heads up but the way you load the AudioInputStream will most likely fail in Java 7 via a Mark/Reset error. Better to use the following form instead:
URL url = AudioMixer.class.getResource(fileName);
AudioInputStream ais =
ra4king helped me debug that one!