| Summary: | Crashes due to the non thread-safe SDL_malloc/SDL_free on Windows | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Pavlo Ilin <pashkoff2> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | keith.oconor, pashkoff2 |
| Version: | 2.0.3 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 8 | ||
| Attachments: | Example to reproduce the crash | ||
|
Description
Pavlo Ilin
2014-04-13 10:17:46 UTC
That is amazing that nobody else has reported this. I think we'll look into ptmalloc, since we want to avoid a C runtime dependency. Thanks! For future reference, a version of ptmalloc with a license we can use is available here: http://www.malloc.de/ Latest version of ptmalloc3 is released 2006 and based on dlmalloc 2.8.3 (same as in SDL). ptmalloc would be probably the easiest to integrate, because it should be the closest relative of dlmalloc. But there are a lot of good allocators. May be it's worth to consider them. Doug Lea in his latest dlmalloc 2.8.6 also mentions nedmalloc as a possible substitute (http://www.nedprod.com/programs/portable/nedmalloc and https://github.com/ned14/nedmalloc). Nedmalloc claims to be slightly better than ptmalloc3. jemalloc can be other replacement (http://www.canonware.com/jemalloc/ and https://github.com/jemalloc/jemalloc/). Looks like it is a default allocator in FreeBSD and was used quite successfully in Firefox, Facebook, and Blender. Both projects were alive in the last years. FYI, I had a crash when cleaning up SDL threads that I debugged and came to the same conclusion as Pavlo - see the discussion thread at http://forums.libsdl.org/viewtopic.php?p=43411 that also has sample code to repro the crash (although Pavlo's is a better example). I was also surprised that this hasn't come up before now, and only found this bug now when I went to log it myself. Strange timing, nothing for 6 years and then twice in one month! This bug is taken care of for a while, until someone has time to investigate the other malloc() implementations. https://hg.libsdl.org/SDL/rev/3b1ed6708ce9 Thanks! |