Ulrich Drepper has a blog entry about using the environment variable MALLOC_PERTURB_ to aid in the detection of typical memory usage bugs in programs.

Using this debugging feature is as simple as setting the environment variable and running the program you want to test. No recompiling required. Sweet!