PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.37k stars 286 forks source link

DirectSound Host API leaks the streaming thread handle #925

Open dechamps opened 4 weeks ago

dechamps commented 4 weeks ago

This code:

https://github.com/PortAudio/portaudio/blob/18a606e1f928852bfc29639d9539ae74d37b5dee/src/hostapi/dsound/pa_win_ds.c#L109

Is incorrect - the official docs suggest the opposite:

when you use _beginthreadex and _endthreadex, you must close the thread handle by calling the Win32 CloseHandle API

This means DirectSound will leak a thread handle on every stream. This can be confirmed empirically by looking at the process Win32 handle list in e.g. Process Explorer.

I already have a fix for this in #922.