ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages

 

This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

This manual page is associated with the Mac OS X developer tools. The software or headers described may not be present on your Mac OS X installation until you install the developer tools package. This package is available on your Mac OS X installation DVD, and the latest versions can be downloaded from developer.apple.com.

For more information about the manual page format, see the manual page for manpages(5).



heap(1)                   BSD General Commands Manual                  heap(1)

NAME
     heap -- List all the malloc-allocated buffers in the process's heap

SYNOPSIS
     heap [-guessNonObjects] pid | partial-executable-name

DESCRIPTION
     heap lists the objects currently allocated on the heap of the specified process, as well as summary
     data.  Objects are categorized by class name, type (Objective-C, C++, or CFType), and binary image.
     C++ objects are identified by the vtable referenced from the start of the object, so with multiple
     inheritance this may not give the precise class of the object.

     The binary image identified for a class is the image which implements the class, not necessarily the
     binary image which caused the objects to be allocated at runtime, or which "owns" those objects.

     heap requires one parameter -- either a process ID or a full or partial executable name.

     The -guessNonObjects option causes heap to look through the memory contents of each Objective-C object
     to find pointers to malloc'ed blocks (non-objects), such as the variable array hanging from an NSArray.
     These referenced blocks of memory are identified as their offset from the start of the object (say
     "NSCFArray[12]").  The count, number of bytes, and average size of memory blocks referenced from each
     different object offset location are listed in the output.

SEE ALSO
     malloc(3), leaks(1), malloc_history(1), vmmap(1)

     The developer tools for the system also include a graphical application, /Developer/Applica-tions/Instruments.app, /Developer/Applications/Instruments.app,
     tions/Instruments.app, that provides instruments that give information similar to that provided by
     heap. The ObjectAlloc instrument graphically displays dynamic, real-time information about the object
     and memory use in an application, including backtraces of where the allocations occured.  The Leaks
     instrument in performs memory leak analysis.  To use these instruments, the target application must be
     launched from Instruments.app, whereas heap can examine existing processes.  heap also has the advan-tage advantage
     tage that the data can be immediately parsed by text-based tools, and impacts the system less because
     it is not a full graphical application.

BSD                             March 15, 2007                             BSD

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.