Jump to content
  • Advertisement
Sign in to follow this  
3dmodelerguy

Finding Memory Leaks

This topic is 3784 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 trying to follow a tutorial on using smart pointers and came to a problem. I want to test my code with and without the auto gc but when i run code that i know that has a memory leak my debug console window does not show it like that tutorials says. Is there an easy way to find out if my program in having a memory leak?

Share this post


Link to post
Share on other sites
Advertisement
If you're using visual studio use: _CrtDumpMemoryLeaks() or _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ). Some additional information regarding tracking memory leaks with Visual Studio is here.

There are other tools available as well:

purify

or

valgrind

Basically, not matter what major platform you're on, something will be available.

Share this post


Link to post
Share on other sites
I tried adding

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

and then the function call at the end of the program and nothing get printed out to the debug output after the program ends. not sure why this is happening.

Share this post


Link to post
Share on other sites
Quote:
Original post by fpsgamer
If you're using visual studio use: _CrtDumpMemoryLeaks() or _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ). Some additional information regarding tracking memory leaks with Visual Studio is here.

There are other tools available as well:

purify

or

valgrind

Basically, not matter what major platform you're on, something will be available.



are these all pertaining to .NET? or will these work with native C++?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!