I actually disagree; malloc should *never* return NULL:
- as you mentionned, even if it returns non-NULL, the process might end up
killed later because of over-commitment, so returning NULL is only sometimes
useful.
- most programs don't know what to do when malloc return NULL, so they end up
killing themselves: why bother ask the process to kill itself ?
i.e. it's a waste of the programmer's time.
Stefan
PS: the only improvement over killing some process would be to send a
SIGOOM first, in order to give the process a chance to clean up before
exiting. But this cleanup is likely to fail because in OOM situations,
tons of things cannot be done. So you'd want to keep around a few extra
KBs (similar to the reserved-blocks of ufs).
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/