mimalloc
mimalloc copied to clipboard
Question about the return value of method `mi_page_extend_free(...)`
Does the following code should return false instead of true?
https://github.com/microsoft/mimalloc/blob/09a27098aa6e9286518bd9c74e6ffa7199c3f04e/src/page.c#L642
Which should signal the page extend failed?
From looking at the usage it seems more consistent if the capacity >= reserved case returned false as you suggested. Callers appear to interpret false as "extend failed" and true as "blocks available".
The code above also caught my eye:
mi_assert(page->free == NULL);
if (page->free != NULL) return true;
In debug it aborts, in release it silently “succeeds”. Might be worth aligning that so both builds handle it the same way..?