14 ms·
In the case of a browser plugin, I'd be quite annoyed if an out of memory condition in the plugin caused my whole browser to quit. I'd experience something bey
by tedunangst 17y ago
In the case of a browser plugin, I'd be quite annoyed if an out of memory condition in the plugin caused my whole browser to quit. I'd experience something beyond annoyance if printing caused my word processor to quit without saving. The never fail malloc wrapper makes sense for some programs, but not for others where better, context sensitive recovery is possible.
- dbenamy 17y agoIn the context of a browser plugin, "quit" could just mean to stop executing and throw up an error message. It doesn't necessarily mean to end the whole process (browser).
- tedunangst 17y agoThrowing up an error message is likely to require allocating some of the memory you just ran out of. There's very little you can reasonably expect to do when you run out of memory. The caller needs to carefully back out, but this isn't something a wrapper can do by itself.
- Dove 17y agoSeems the best solution is to just throw an exception . . . . . . er, crap. This is C, isn't it?
- jacquesm 17y agoC can throw exceptions. the call is 'raise'.
- mfukar 17y agoStrings are still statically allocated (courtesy of C compilers everywhere), right? and I guess if you have to make one function call to throw an error message, there's some room left in the stack.. and then there's the whole virtual memory thing.. but I could be reasonably wrong. :-)