🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Detecting Memory Leaks

Started by
2 comments, last by Peter Gmeiner 24 years, 3 months ago
Hi !! I have some Memory Leaks in my project and do not know who in my project Memory is allocated and later not deleted. So I read in the MSDN that there is a Macro with which you can detect memory leaks: DEBUG_NEW. I tested it on a smaller project. But it needs MFC and in my big project I do not use MFC. So I would ask if there is some another method to detect memory leaks without using the MFC. Thanks !!! Gmeiner
Gmeiner
Advertisement
You could try an application made for that, like Numega BoundChecker (but by my experience, it dont find all of them, neither do VC with the DEBUG_NEW thing).

You could try to link to MFC temporary to have the DEBUG_NEW support...

LOGGING!

You need to log whenever you allocate memory, log whenever you dealloc it.

If you''re using classes in C++ it gets a little easier - add logs to your constructors/destructors.

There''s a really good book - "Writing Solid Code" - that goes into detail on this....

Or you could do it the easy way, assuming you''re using Microsoft Visual C++.

http://support.microsoft.com/support/kb/articles/Q141/4/93.asp

The CRT comes with debugging facilities. Any developer worth their brain mass should take a look at them.

MSN

This topic is closed to new replies.

Advertisement