_CRTDBG_MAP_ALLOC and _CrtDumpMemoryLeaks()
For memory leak detection, I am following the instructions given here:
http://www.codeguru.com/forum/showthread.php?t=312742
...but I am finding that even the simplest console app code is shown to have memory leaks, like this:
int
_tmain(int argc, _TCHAR* argv[]){std::string foo("hello");
_CrtDumpMemoryLeaks();
return 0;
}
The IDE output window says "detected memory leaks" and shows the foo string as leaking. It should never have identified the "hello" string as leaked. And it doesn't tell me which line of code has the problem.
Then I change the "string foo" into an allocation of an integer from the heap using new. This time I expect to be informed of a memory leak and I am. However, instead of telling me the *real* line of code that has the problem, it tells me the problem is here:
c:\program files (x86)\microsoft visual studio 8\vc\include\crtdbg.h(1147) : {121} normal block at 0x01BC6068, 4 bytes long
What am I doing wrong?

