PlaySound has a Memory Leak when called

Aspire 81 Reputation points
2023-09-13T06:08:18.4933333+00:00

I have a demo project where I first call

PlaySound (L "High_A. wav", NULL, SND_ASYNC | SND_LOOP);

to play the audio in a loop, and then call

PlaySound (NULL, NULL, NULL) to stop playing.

When I call PlaySound(L "High_A.wav", NULL, SND_ASYNC | SND_LOOP) again. And I found that the Memory (active private working set) and Page faults of audiodg. exe had both increased in the task manager.

After repeating the above operation multiple times, the Memory (active private working set) of audiodg. exe slowly increased and could not be released. Page faults always increase and no release.

Why? Am I using it incorrectly?

Windows development | Windows API - Win32
Developer technologies | C++
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.