3 ms·
As a community we have basically decided against handling of out of memory; that it's better to crash, and design the program so that such a crash will not caus
by im3w1l 6y ago
As a community we have basically decided against handling of out of memory; that it's better to crash, and design the program so that such a crash will not cause corrupt state.
Consider over-commit. It means that the malloc call will succeed even if there isn't available memory. Instead the system just hopes you wont make use of the memory you asked for. And if you do make use of it, well then the OS might kill you. Just like that. No opportunity for error handling.
- eru 6y agoReliably crashing _is_ a way to handle out of memory errors. When you don't handle it, you get something closer to undefined behaviour instead.