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.
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:
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.