Share via

audiodg.exe not releasing memory even after IAudioClient::Release is called

Vijay 21 Reputation points
2022-12-19T09:01:22.537+00:00

Our application switches between audio playback devices. So, it gets the IID_IAudioClient interface through IMMDevice::Activate and then calls IAudioClient::Initialize to initialize the audio stream. When the playback device changes, the interface pointer to IID_IAudioClient is released by calling the methods in the sequence,
IAudioClient::Stop
IAudioClient::Reset
IAudioClient::Release
But, after the playback device change and IMMDevice::Activate, IAudioClient::Initialize are called again the memory utilization in audiodg.exe increases by about 4MB and it keeps increasing as the playback device switching and the above call sequence continues.
Am I missing anything that causes this issue in audiodg.exe.

Windows development | Windows API - Win32
Windows for business | Windows Client for IT Pros | Devices and deployment | Other
0 comments No comments

Answer accepted by question author
  1. Xiaopo Yang - MSFT 12,736 Reputation points Microsoft External Staff
    2022-12-20T05:33:05.86+00:00

    According to Recovering from an Invalid-Device Error, It's enough to

    Release the IAudioClient interface and any other WASAPI interfaces that it has acquired on the device.

    There could exist any other WASAPI interfaces that it has acquired on the device and not released. See bool CWASAPIRenderer::HandleStreamSwitchEvent() for an example.
    It's better to show a minimal, reproducible sample without private information.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Vijay 21 Reputation points
    2022-12-27T17:56:34.297+00:00

    Thank you for your support and pointing me in the right direction.
    I found that IAudioRenderClient::Release was not called in our code when switching the playback devices. After adding the code to release the interface, the memory is getting released in audiodg.exe and does not keep adding up on switching the playback device.

    0 comments No comments

Your answer

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