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 API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,580 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,683 questions
{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.