• Advertisement

Archived

This topic is now archived and is closed to further replies.

Catching leaks in MFC?

This topic is 5097 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 have some memory leaks in my mfc program, and I''m trying to find out where they are. I''ve read I''m supposed to include something like: #define _CRTDBG_MAP_ALLOC #include <stdlib.h> #include <crtdbg.h> and then add another statement at the beginning of my program, but I don''t know where the ''beginning'' is for MFC. I tried adding _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); in numerous places in the main app file, but I didn''t get anything.

Share this post


Link to post
Share on other sites
Advertisement
http://gha.booleangate.org/archive/Detecting_and_isolating_memory_leaks_using_MS_VC++.html

Share this post


Link to post
Share on other sites
I get this output:
Dumping objects ->
{48} normal block at 0x00C52638, 33 bytes long.
Data: < C > 00 43 00 CD CD CD CD CD CD CD CD CD CD CD CD CD
{47} normal block at 0x00C525D0, 40 bytes long.
Data: < |L > 14 7C 4C 10 16 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.


So I put _CrtSetBreakAlloc(48); at the beginning of InitInstance() in my main app file, but it didn't do anything.

[edited by - Sfpiano on February 8, 2004 12:22:13 PM]

Share this post


Link to post
Share on other sites
This might be a useful article to read. It might be more then what you need but hey it is pretty simple to implement.

Richard Dickerson


Pikestriker Games


"Kids you tried hard and failed miserably, lesson learned never try" - Homer Simpson

Share this post


Link to post
Share on other sites

  • Advertisement