3 ms·
Nonsense. The application running out of memory isn't the responsibility of the application. If this is a job for anyone, it's a job for the operating system,
by geocar 13y ago
Nonsense.
The application running out of memory isn't the responsibility of the application.
If this is a job for anyone, it's a job for the operating system, however malloc() fails infrequently enough that it hasn't yet been worth it.
Or does your minecraft implementation in C pre-allocate memory for its nice error message at startup, resorting to direct I/O operations against video ports if that allocation fails?
- k__ 13y agoI thought it was common ground for C-game-devs to check how much memory the game needs total, allocate it at start and handle it's management manually (for performance reasons). Wouldn't this also allow for creating a simple out-of-memory error on start?
- EpicEng 13y agoNonsense. Well, it depends. Writing a Minecraft clone? Yeah, you can probably just give up. That doesn't mean you shouldn't be checking for failure. Check, if failed, pop up a message, log something, and die. However, not all applications are created equal. If I'm writing a (for example) safety critical piece of code then I may not have the luxury of just exiting (I may not be using dynamic memory allocation at all either, but that's neither here nor there.) It may be more beneficial to my users (or absolutely required) to attempt to recover. Not all software can just exit on a whim, but obviously this is a small portion of the software that exists.