This doesn't address your question directly, but I felt compelled to respond. As you say, tools like the CRT check functions only give you a small level of confidence, and don't address resource leaks other than memory. If you find yourself depending on such tools I would say there is something very, very wrong with your approach to C++ development. In the past 10 years, I have not had a single problem in my code associated with memory leakage. This is not because I am some C++ coding god, but because I use the basic tools of RAII, smart pointers and standard library collections in my code, and wherever possible avoid explicit dynamic memory allocation using new
. Whenever you find yourself writing a line of code like:
Something * p = new Something;
stop, and ask yourself "Is there some way I could avoid doing this?" and if the answer is "no", then ask yourself why you are allocating memory to a raw pointer, and if you can't find any way around that (which should very rarely be the case, immediately write the code to manage the pointers de-allocation, and make sure that that code is exception-safe.
If you take this approach, you won't need tools like special CRT functions or Valgrind, and you will save yourself oceans of time in debugging.