I've been investigating what appeared to be a handle leak in my app, and
have finally narrowed it down to a single MM api call: PlaySound
If I create a trivial project and make a simple call, e.g.
::PlaySound( "SystemExclamation", hMod, SND_ASYNC | SND_ALIAS )
then the handle count steadily grows... and grows..
I'm running XP Pro. The sound on my machine is NForce2 Soundstorm (with
recent NVidia drivers). I've tried this on a different machine (same OS,
different sound hardware and drivers) and the "leak" is still there,
although handle consumption is slower (1 handle not released per play).
Is this something I should worry about, or will Windows eventually do
some kind of cleanup? Is there some kind of cleanup I should be doing?
P.S. you don't even need code to see MM handle consumption: just bring
up the WinXP sound cpl, switch to the sound tab, select a system sound
and keep pressing play. Open Task Manager while you're doing this and
watch the handle count for Rundll32 steadily rise.