3 ms·
No code is written to handle allocation failure because it knows that it's running on an OS with overcommit where handling allocation failure is impossible. Ove
by Arnavion 4y ago
No code is written to handle allocation failure because it knows that it's running on an OS with overcommit where handling allocation failure is impossible. Overcommit means that you encounter the problem not when you call `malloc()` but when you do `*pointer = value;`, which is impossible to handle.
- kevin_thibedeau 4y agoPlenty of code runs on systems without that behavior. Graceful handling of malloc failure is still useful.
- Arnavion 4y agoI know. I myself write code that checks the result of malloc. I was responding with josefx's words.