Why can't I create a memory leak?

Started by
1 comment, last by haro 20 years, 11 months ago
I was just testing something. I wanted to see how well VC7.0 reports memory leaks. I created a simple program that called a function within a class that allocated/assigned memory for yet another new class. The memory was never released. I ran the program in debug mode, and no memory leaks were reported. This seems unusual. Any ideas why?
Advertisement
couple of things: 1) did you include the code that reports memory leaks? and 2) what scope does the object have relative to that code? i had problems with this when i had objects that leaked memory declared in main, and i also had the mem leak detection code declared in main. the problem was that i was using _CrtDumpMemoryLeaks which i called at the end of main, but the destructors of the objects were leaking the memory, and since _CrtDumpMemoryLeaks was called before the object went out of scope, it never reported the memory leaks (but they were definately there)
Thanks! Your question reminded me I was making an incorrect assumption. Problem solved.

This topic is closed to new replies.

Advertisement