libgmalloc
puts guard pages at the end of malloc'd blocks of memory, letting you catch buffer overruns. (This will hugely inflate your program's working set, and may lead to swapping) To turn onlibgmalloc
in gdb, do this:(gdb) set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib