2 ms·
Well, considering malloc gives a NULL pointer on failure, a crash at some point is pretty clearly inevitable.
by webkike 11y ago
Well, considering malloc gives a NULL pointer on failure, a crash at some point is pretty clearly inevitable.
- Sanddancer 11y agoYes, but it becomes harder to tell where in the code that happened. If you run abort() or the like, you've got more information as to the circumstances of the crash.
- richm44 11y agoSadly it doesn't on linux due to overcommit. You can actually get the failure much later when you try to use the memory. The exception is when you try to allocate absolutely huge buffers. So malloc returning a valid pointer doesn't indicate success (though it returning NULL does indicate failure).