"We learned that malloc should return NULL in case of out-of-memory.
However, it is not the case in Linux. By default, Linux uses
optimistic memory allocation strategy. Under this strategy,
Linux assumes there always exists free memory. The memory region
returns by malloc is not actually allocated until the process
touches the memory region. This means the memory region returns
by malloc may not be available. In case of out-of-memory, the
OOM Killer in Linux will pick up one or more process to kill."
http://ahlamnote.blogspot.com/2007/04/optimistic-memory-allocation-strategy.html