BASS WASAPI beta (uses BASS_DEVICE_PROCESS) Memory leak?

Started by AndyMK,

AndyMK

Hi Ian. Since we last spoke, i made the decision to move all my code to c++ although i am still learning the ins and outs of the language. I made a separate app that rapidly opens and closes audio sessions to test my AudioSessionEvents code. No leaks there. When i introduced BASS_WASAPI_Init() and BASS_WASAPI_Free() into the code, i noticed a very small increase in memory usage over time although everything works just fine. If you need any more information, please let me know. I tried doing CreateStream -> Add to mixer -> remove from mixer -> free stream -> BASS_WASAPI_Free. It seems to leak ever so slightly over thousands of sessions.

Ian @ un4seen

Is the leak only happening when you use the new BASS_DEVICE_PROCESS option, and not when using the same BASSWASAPI build without that option? Please also check whether it happens if you only call BASS_WASAPI_Init and BASS_WASAPI_Free (no BASS_WASAPI_Start).

AndyMK

Hi Ian. It seems that both the normal version and the beta version exhibit the same behavior. I made a simple method

int64_t AddChannel(DWORD freq, int processId) {
    if (BASS_WASAPI_Init(-1, freq, 2, BASS_WASAPI_EVENT, 1, 0, OutputWasapiProc, 0)) {
        if (BASS_WASAPI_Start()) {
            if (BASS_WASAPI_Free()) {
                return true;
            }
            UtilityFunctions::printerr("3");
            return false;
        }
        UtilityFunctions::printerr("2");
        return false;
    }
    UtilityFunctions::printerr("1");
    return false;
}

This causes a leak. The leak is very slow, around 1MB - 2MB per minute. I know it's not realistic to open and close devices this quick like this but in normal usage, especially using process Id where some browsers constantly open and close sessions, it starts to be noticeable. I may be doing something wrong or missing something. I currently writing a wrapper in GDExtension for the Godot Engine.

AndyMK

Hi Ian. I can't reproduce the problem in Purebasic. Sorry for wasting your time. I'll have to see what i'm doing wrong in c++.