Get flash to fully experience Pearltrees
New : AddressSanitizer is released as part of LLVM 3.1. New : Watch the presentation from the LLVM Developer's meeting (Nov 18, 2011): Video , slides . New : Read the USENIX ATC '2012 paper . AddressSanitizer (aka ASan) is a memory error detector for C/C++. It finds: This tool is very fast.
Simply compile and link your program with -fsanitize=address flag. The AddressSanitizer run-time library should be linked to the final executable, so make sure to use clang (not ld ) for the final link step. When linking shared libraries, the AddressSanitizer run-time is not linked, so -Wl,-z,defs may cause link errors (don’t use it with AddressSanitizer).
If you've wanted to add static analysis to your C/C++ project which uses CMake but didn't know how, then you'll want to read this. This post is mostly a note for myself so I don't have to google it later ;) If you're using Debian it's actually quite easy. Just install the clang package with:
Were we to craft a Lenox Globe of programming languages, C++ might be followed by a famous cautionary phrase: Here Be Dragons. The language can be complex and daunting to programmers who are often shouldered with the task of writing large, complex programs. Those millions of code monkeys need help to resist Murphy's siren song and navigate C++'s treacherous waters of memory corruption and concurrency bugs.