Why can't I create a memory leak?
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?
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)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement