naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.37k stars 1.09k forks source link

Bug: possible memory leak #1145

Open amadeo-alex opened 3 months ago

amadeo-alex commented 3 months ago

Hello,

I've been experimenting with various "CoreAudio" wrapper libraries and it looks like most of them, including this one, appear to be leaking memory - slowly but constantly (or it's me using the library wrong, not excluding that :D)

I have a memory dump created at the end of the tests however github allows attachments only up to 25MB - compressed dump is 30MB+. I can deliver it via preferred method if required.

Test project is a clean new one with NAudio installed via nuget. Code used for testing (put directly into main function):

        var enumerator = new MMDeviceEnumerator();
        while (true)
        {
            foreach (var device in enumerator.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active))
            {
                var tempVar = device.DeviceFriendlyName;
                device.Dispose();
            }
        }

Results: kdJ9dJ 9fo45P IRUkQI IMYXZF