Valgrind for Mac OS X. Some assembly required.

Valgrind is a powerful open-source memory debugger. This is a port of Valgrind for Mac OS X.
http://valgrind.org/
http://www.apple.com/macosx/

Caveat programmer

This port is UNSUPPORTED and INCOMPLETE and BUGGY. It may not find bugs in your program, or run your program correctly, or run your program at all.

Requirements

Download and build

Valgrind's Mac OS X support is now part of Valgrind's main development trunk. Follow their instructions to download and build the latest code.
http://valgrind.org/downloads/repository.html

Run

    valgrind [--arch=] [valgrind-options...] /path/to/program [program-options ...]

Some things that don't work

Errors in system libraries

Some system libraries have false positives or legitimate errors. Valgrind has a "suppression file" mechanism to ignore specified errors. This port does not include any suppressions, so you'll have to discover them on your own. Please do not file bug reports against system libraries on Valgrind evidence alone.

Messages you may see while running

If you see messages like the following, then your program is using a system call that Valgrind doesn't support. Your program may run incorrectly after this.

    UNKNOWN syscall
    UNKNOWN mach message descriptor
    UNKNOWN host message
    UNKNOWN task message
    UNKNOWN thread message
    UNKNOWN fcntl
    UNKNOWN ioctl
Messages like the following can probably be ignored.
    UNKNOWN __disable_threadsignal is unsupported
    UNKNOWN sigaction is unsupported
    UNKNOWN Mach port modified
Messages like the following indicate a mismatch between Valgrind's memory map and the kernel. Occasional failures are expected in multithreaded programs. If the failure repeats for the same address range, then there may be a problem causing false errors or crashes.
    sync check at ...: FAILED


seal! Greg Parker
gparker@apple.com
Sealie Software