debug builds are massively broken on Windows
Before !4324 (merged), most of mesa used MALLOC_STRUCT()
and CALLOC_STRUCT()
from src/util/imports.h
, which maps directly to malloc()
and calloc()
. Hoever, !4324 (merged) changed to use the versions from src/util/u_memory.h
instead. This seems like a fine enough cleanup... however:
- On Windows debug-builds
MALLOC_STRUCT()
/CALLOC_STRUCT()
maps todebug_malloc()
/debug_calloc()
instead. -
debug_malloc()
/debug_calloc
requires to be freed usingdebug_free()
- Many call-sites in mesa allocates using
MALLOC_STRUCT
/CALLOC_STRUCT
, but frees usingfree()
to deallocate.
The end result is that debug-builds on Windows crash hard, due to freeing the wrong pointer. This leads to heap-corruptions all over the place.
This also happens in the tagged release 20.1.0-rc1.