Sign in to follow this  

The crtdbg Leak Report

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

This topic is 3791 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this