Instrument the c++ code using clang and then parse the output of Valgrind.