Jump to content
  • Advertisement
Sign in to follow this  
skullbonez

Memory leaks

This topic is 4834 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

Hi, I am using the _CrtDumpMemoryLeaks() call to detect memory leaks, it is working fine when I make a blatent mistake such as: int main() { MyClass* c = new MyClass(); _CrtDumpMemoryLeaks(); } BUT, for some reason my application (it is a real time physics simulation, so don't cringe too hard when you hear this) seems to be leaking 1mb every 5 seconds, and I am getting absolutely no notifications of detected memory leaks in VC++! I know the leakage is occuring because I use the task manager to check the memory usage for the process. This is in the release build, even when running outside of the dev env. Could someone give me an idea on how I could track where this memory is going? I know I can use memory profiling programs etc, but isn't there a simpler way? For the memory to climb at such a huge rate it must be something obvious right? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Try isolating the memory leak by disabling parts of your application. This way you might be able to locate it or at least have a rough idea of where it's located.

If that doesn't help, I can higly recommend Paul Nettle's free but powerful MemoryManager (MMGR). It traces every memory allocation within your application, and can even detect overflows. Visual C++ has a very handy feature that allows to automatically force a header to be included in every source file of a project. This way all memory allocation functions are overloaded with Paul Nettle's allocation functions.

Share this post


Link to post
Share on other sites
As has been said so many times before, and will doubtless be said many times again the memory usage in Task Manager is NOT something to heed. If you want an accurate memory usage tracker, you either write your own, or use an available one. You do not use Task Manager. If no leaks are being detected, then there aren't leaks (99.9%).

Share this post


Link to post
Share on other sites
you could try using this memory leak code instead:
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_LEAK_CHECK_DF);

it detects leaks after the program ends, eg u can put this line at the start of the program.

its headers are:
#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

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!