diff --git a/src/opt/mm_malloc.h b/src/opt/mm_malloc.h index 718ea702..a7e7322b 100644 --- a/src/opt/mm_malloc.h +++ b/src/opt/mm_malloc.h @@ -33,5 +33,9 @@ void mm_forHeap(V2v f); void mm_dumpHeap(FILE* f); static u64 mm_round(usz x) { return x; } -static u64 mm_size(Value* x) { return malloc_usable_size(x); } +static u64 mm_size(Value* x) { + size_t r = malloc_usable_size(x); + if (((ssize_t)r) < 16) err("MM=0 requires working malloc_usable_size"); + return r; +} static u64 mm_totalAllocated() { return -1; }