libsdl-org / SDL_mixer

An audio mixer that supports various file formats for Simple Directmedia Layer.
zlib License
433 stars 146 forks source link

memory leaks when calling Mix_OpenAudio in macOS #493

Open zjdx1998 opened 1 year ago

zjdx1998 commented 1 year ago

OS: macOS 13.1 (22C65) Chip: Apple M1 Pro Workflow: SDL_Init(SDL_INIT_VIDEO); TTF_Init(); Mix_OpenAudio(); Mix_FreeChunk(); Mix_CloseAudio(); Mix_Quit(); SDL_Quit();

Then always get 64 bytes memory leak.

STACK OF 1 INSTANCE OF 'ROOT LEAK: <CFString>':
17  libsystem_pthread.dylib               0x1b0e57e2c thread_start + 8
16  libsystem_pthread.dylib               0x1b0e5d06c _pthread_start + 148
15  org.libsdl.SDL2                       0x1029ad3ac 0x102984000 + 168876
14  org.libsdl.SDL2                       0x1029a4cf4 0x102984000 + 134388
13  org.libsdl.SDL2                       0x1029bc334 0x102984000 + 230196
12  org.libsdl.SDL2                       0x1029bc7f0 0x102984000 + 231408
11  com.apple.audio.CoreAudio             0x1b2f57f50 AudioObjectGetPropertyData + 256
10  com.apple.audio.CoreAudio             0x1b320eac0 HALPlugIn::ObjectGetPropertyData(HALObject const&, AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int&, void*) const + 64
9   com.apple.audio.CoreAudio             0x1b3101dbc HAL_HardwarePlugIn_ObjectGetPropertyData(AudioHardwarePlugInInterface**, unsigned int, AudioObjectPropertyAddress const*, unsigned int, void const*, unsigned int*, void*) + 556
8   com.apple.audio.CoreAudio             0x1b3231464 HALC_ShellObject::GetPropertyData(unsigned int, AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int, unsigned int&, void*) const + 340
7   com.apple.audio.CoreAudio             0x1b3231210 HALC_ShellObject::ExecuteCommand(void () block_pointer) const + 80
6   com.apple.audio.CoreAudio             0x1b34438d4 HALB_CommandGate::ExecuteCommand(void () block_pointer) const + 232
5   com.apple.audio.CoreAudio             0x1b3232328 invocation function for block in HALC_ShellObject::GetPropertyData(unsigned int, AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int, unsigned int&, void*) const + 128
4   com.apple.audio.CoreAudio             0x1b300b9bc HALC_ShellDevice::_GetPropertyData(unsigned int, AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int, unsigned int&, void*, unsigned int&, AudioObjectPropertyAddress&, bool&) const + 1224
3   com.apple.CoreFoundation              0x1b0ebd768 CFStringCreateWithCString + 96
2   com.apple.CoreFoundation              0x1b0ebe024 __CFStringCreateImmutableFunnel3 + 2216
1   com.apple.CoreFoundation              0x1b0ebe7f4 _CFRuntimeCreateInstance + 436
0   libsystem_malloc.dylib                0x1b0cc6d48 _malloc_zone_calloc_instrumented_or_legacy + 92
====
    1 (64 bytes) ROOT LEAK: <CFString 0x156087160> [64]