Finding Memory Leaks

Unlike optimizations, which are unnecessary for many applications, memory leaks are usually bugs that need to be fixed. Memory leaks and other memory errors are described in Chapter 5, “Cocoa Conventions.” Memory leaks can cause long running applications to crash, and they can reduce the performance of the operating system by consuming memory that is needed for other applications.

Apple explains how to efficiently use and debug memory at the following URL: http://developer.apple.com/techpubs/macosx/Essentials/Performance/VirtualMemory/Allocating__eing_Memory.html.

Apple provides developer tools for finding memory leaks. The easiest tool to use is ObjectAlloc, and can be used with any Cocoa application. Another tool is MallocDebug, ...

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.