Temporary fix for bug 2494 - Crashes due to the non thread-safe SDL_malloc/SDL_free on Windows
authorSam Lantinga <slouken@libsdl.org>
Sat, 10 May 2014 11:27:43 -0700
changeset 87583b1ed6708ce9
parent 8757 aeeeb47a5a77
child 8759 18eb59aa5913
Temporary fix for bug 2494 - Crashes due to the non thread-safe SDL_malloc/SDL_free on Windows

We'll define USE_LOCKS as a temporary fix until an alternative like ptmalloc, jemalloc, or nedmalloc can be investigated.
http://www.malloc.de/en/
http://www.canonware.com/jemalloc/
http://www.nedprod.com/programs/portable/nedmalloc/

SDL allocates memory very infrequently, so this is probably a decent fix for a while.
src/stdlib/SDL_malloc.c
     1.1 --- a/src/stdlib/SDL_malloc.c	Fri May 09 21:28:52 2014 -0400
     1.2 +++ b/src/stdlib/SDL_malloc.c	Sat May 10 11:27:43 2014 -0700
     1.3 @@ -54,6 +54,7 @@
     1.4  #define LACKS_STRING_H
     1.5  #define LACKS_STDLIB_H
     1.6  #define ABORT
     1.7 +#define USE_LOCKS 1
     1.8  
     1.9  /*
    1.10    This is a version (aka dlmalloc) of malloc/free/realloc written by