Valgrind is an award-winning instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail.
For each item you purchase, we donate part of our profits to Valgrind. This way we all win :)
More information: http://valgrind.org/