filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.17k stars 450 forks source link

Potential memory leak in StreamingSourceVoice.Create #66

Closed skwasiborski closed 8 years ago

skwasiborski commented 8 years ago

It seems that application we are working on suffers from a memory leak that is related to usage of CSCore. After calling StreamingSourceVoice.Create an instance of VoiceCallback is created. From the VoiceCallback instance a COM callable wrapper is created but it seems that this wrapper is never released even after StreamingSourceVoice is disposed.

Live reference to VoiceCallback can be expensive because through VoiceCallback.StreamEnd handler VoiceCallback references StreamingSourceVoice which keeps instance of IWaveSource alive.

filoe commented 8 years ago

I've made an attempt to fix the issue. Please test it, and give me some feedback whether it fixes your issue.

filoe commented 8 years ago

I would guess, you've fixed it with #72 :+1: