We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1924

Summary: memory leak? Mix_FreeChunk not freeing memory properly
Product: SDL_mixer Reporter: Adrian <adrian.wielgosik>
Component: miscAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86   
OS: Windows 7   

Description Adrian 2013-06-20 16:58:07 UTC
(Using stable (not hg) versions of SDL2 and SDL2_mixer)

Code used to check:
https://gist.github.com/adrian17/8f3c3f434732e19c5bf7

According to Task Manager, memory usage doesn't reduce after Mix_FreeChunk is called. Used in loop, results in a constant leaking of memory.

Citing caedes from IRC:

[22:40] <caedes__> http://hg.libsdl.org/SDL/file/c7346a060a7d/src/audio/SDL_wave.c#l603
[22:41] <caedes__> and Mix_LoadWav uses the SDL_wave stuff for .wav
[22:42] <caedes__> but doesn't use SDL_FreeWAV
[22:42] <caedes__> maybe it has something to do with that, maybe not
[22:42] <caedes__> (do DLLs have their own heaps or something?)
[22:44] <caedes__> http://hg.libsdl.org/SDL_mixer/file/030181ff9f59/mixer.c#l748 and http://hg.libsdl.org/SDL_mixer/file/030181ff9f59/mixer.c#l603 are the relevant parts in SDL_mixer
Comment 1 Sam Lantinga 2013-06-29 18:12:29 UTC
I haven't had a chance to try this on Windows yet, but for what it's worth, it works fine on Mac OS X, running forever without leaking memory.