2 ms·
>on most platforms malloc is guaranteed not to return NULL This is only true on Linux, and isn't even guaranteed there. I'm pretty sure the default overcommit
by PeCaN 8y ago
>on most platforms malloc is guaranteed not to return NULL
This is only true on Linux, and isn't even guaranteed there. I'm pretty sure the default overcommit handling mode is still to refuse allocations that are much larger than there is free memory to support. (This was the case around 2.6.)
It's generally preferable for software to check if malloc() failed and have a chance to recover.