error on non-functional malloc_usable_size

This commit is contained in:
dzaima 2022-04-07 01:19:35 +03:00
parent 267a62d292
commit ff7a4cb0cb

View File

@ -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; }