Apart from buying BoundsChecker or any of the other tools to track down memory leaks. Does anyone have any advice or tips from your years of programming experience to offer on how to track down the causes of memory leaks?
I find that the big dump that happens at the end of a program does not typically lend any useful clues as to where or what was allocated that was not freed. I find that I have to back track and comment out sections of code until through the process of elimination and trial-and-error, I am able to narrow down where the problem is. And since this is usually at the bottom of the To-Do list, the memory leaks are not plugged.

Mike GoldPosted Oct 17, 2007, 12:31 AM
there is a technique for doing this in Visual C++. The way I used to do it was look at the leak numbers that are dumped after exiting the program that are between the brackets (e.g. {40})
In your code, in initinstance, put the following line of code
_CrtSetBreakAlloc (40) and rerun the program in the debugger
The code will break at the exact call trace of the memory leak.
Also check these articles:
http://support.microsoft.com/kb/q151585/
http://msdn2.microsoft.com/en-us/library/4wth1ha5(VS.80).aspx
http://www.codeproject.com/cpp/MLFDef.asp
http://www.codeproject.com/tools/visualleakdetector.asp
and this one
http://www.codeguru.com/forum/showthread.php?t=312742