title: Should we check if memory allocations fail?
body: <p>I've seen a lot of code that checks for NULL pointers whenever an allocation is made. This makes the code verbose, and if it's not done consistently, only when the programmer felt like it, doesn't even ensure that the program won't crash when the address space runs out. Besides, if the program can't make more allocations, it wouldn't be able to do its function anyway, right?</p>
  
  <p>So my question is, isn't it better for most programs not to check at all and just let the program crash if memory runs out? At least the code is more readable that way.</p>
  
  <p><strong>Note</strong></p>
  
  <p>I'm talking about desktop apps that run on modern computers (at least 2 GB address space), and that most definitely don't operate space shuttles, life support systems, or BP's oil platforms. Most importantly I'm talking about programs that use malloc but never really go above 5 MB of memory usage.</p>