Debugging Memory Problems
Errors in memory management cause a huge number of problems when programming in C and can lead to difficult-to-track-down bugs since the manifestation of a problem can happen long after the actual program error happened.
Common API issues
When malloc() cannot allocate memory, it returns NULL. Many programmers tend to ignore NULL results from malloc(). The conventional wisdom was that if memory really is exhausted, then the system is in some pretty serious trouble and is swapping heavily. In that case, it is just easier to crash and restart. Plus, it can be tedious to check the return value of malloc() all the time. In these days of systems with many gigabytes of RAM, it’s possible for an app to fill up its address space ...
Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.