Jump to content
  • Advertisement
Sign in to follow this  
dave

The crtdbg Leak Report

This topic is 4002 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'd like to know whether there is a stage of the leak dump where all logged leaks are compiled prior to being output. I suspect that leaks are logged right up until the call to dump the leaks to the output window and then they are just streamed out. To put it another way, can any allocations or deallocations be missed aside from those allocated before the crtdbg kicks in and those deallocated after the dump? Hope that makes sense, Dave

Share this post


Link to post
Share on other sites
Advertisement
The CRT reporting functions don't work on a logging basis. When you call a function like _CrtDumpMemoryLeaks(), the function walks the heap structure and create its report from there. As such no allocations or deallocations can be missed, as long as they use the CRT memory allocation functions. If you're having troubles with _CrtDumpMemoryLeaks(), you may want to consider using _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ) instead.

Share this post


Link to post
Share on other sites
Hi Dave

The best tool to trace leakages is without doubt MMGR from Paul Nettle (Fluid Studios), even those that dont come up using _CrtDumpMemoryLeaks(), are logged as it logs every memory leakage.

All you need to do is just include the header file "mmgr.h" into your project and it automatically does all the logging for you.... It one of the best tools available....

Keep it up Mate

Share this post


Link to post
Share on other sites
Quote:
Original post by WillPash
Hi Dave

The best tool to trace leakages is without doubt MMGR from Paul Nettle (Fluid Studios), even those that dont come up using _CrtDumpMemoryLeaks(), are logged as it logs every memory leakage.

All you need to do is just include the header file "mmgr.h" into your project and it automatically does all the logging for you.... It one of the best tools available....

Keep it up Mate
While I agree that mmgr is a good tool, it doesn't track STL "leaks" and it can be difficult to integrate into existing projects since it MUST be included after STL headers and before game headers.

I like to track STL allocations because it gives me a better idea of when allocations are happening. We also track STL allocations at work to help prevent memory fragmentation caused by STL allocations happening at bad times and fragmenting memory for the whole game.

Tracking STL allocations also shows up bugs like forgetting to clear (we use the vector swap trick to deallocate vectors properly) a vector before adding more elements to it (Something that's happened a few times at work).

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!