Managing Memory

Large portions of the errors in computer programs are byproducts of dynamic memory allocation. Dynamic-memory allocation enables a program to allocate as much memory as it needs on a case-by-case basis. When an application dynamically allocates memory, the operating system provides the requested memory as long as it is possible. The total memory allocated can be as large as the computer’s physical memory, virtual memory, and addressing conventions will allow. The theoretical limit to the amount of memory that can be allocated by one application on Mac OS X is approximately four Gigabytes.

The difficulty with dynamic-memory allocation is that the application and/or the operating system have to keep track of memory that has been ...

Get Cocoa® Programming 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.