Archived

This topic is now archived and is closed to further replies.

Why can't I create a memory leak?

This topic is 5340 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites