none
MFC memory leaks on exit RRS feed

  • Question

  • Hi All,

    When I exit my application I get a lot of memory leak warnings, they are typically in the form as follows:

    f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtooltipctrl.cpp(39) : {1917663} client block at 0x026769B8, subtype c0, 220 bytes long.
    a CMFCToolTipCtrl object at $026769B8, 220 bytes long
    {1870872} normal block at 0x026F85B8, 114 bytes long.
     Data: <X f a   a       > 58 C8 66 01 61 00 00 00 61 00 00 00 01 00 00 00
    {1870871} normal block at 0x02317218, 26 bytes long.
     Data: <X f             > 58 C8 66 01 09 00 00 00 09 00 00 00 01 00 00 00
    f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\plex.cpp(29) : {1870870} normal block at 0x026F8FE0, 164 bytes long.
     Data: <            (r1 > 00 00 00 00 00 00 00 00 AB 8C D9 D1 28 72 31 02
    f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\map_sp.cpp(76) : {1870869} normal block at 0x02697D10, 68 bytes long.
     Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\afxtooltipctrl.cpp(39) : {1870868} client block at 0x02666568, subtype c0, 220 bytes long.
    a CMFCToolTipCtrl object at $02666568, 220 bytes long
    {1640856} normal block at 0x047C6F98, 23 bytes long.
     Data: <X f             > 58 C8 66 01 06 00 00 00 06 00 00 00 01 00 00 00
    f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\plex.cpp(29) : {1640855} normal block at 0x0265DDF8, 164 bytes long.
     Data: <             o| > 00 00 00 00 00 00 00 00 1D C6 86 B1 A8 6F 7C 04


    and are 12-36 bytes approximately.

    So any idea what the cause of these are and how to make my app clean up after itself?

    I have a feeling it is something to do with CString?

    Thanks
    Tuesday, July 21, 2009 8:13 AM

Answers

  • As a followup I have found putting the following at the top of my stdafx.h


    #ifdef _DEBUG
        #define _CRTDBG_MAP_ALLOC 1
        #include "crtdbg.h"
    #endif
       

    and the following in my app constructor

    #ifdef _DEBUG
        _CrtSetDbgFlag(1);
    #endif


    results in much more debug info regarding the memory leaks. I've found some due to tooltips not been explicitly destroyed and other bits and bobs.

    Thanks
    • Marked as answer by Mark Duffill Wednesday, July 22, 2009 12:52 PM
    Wednesday, July 22, 2009 12:52 PM

All replies

  • >> f:\dd\vctools\vc7libs\

    Why is it using vc7 directories?
    Microsoft MVP - Visual C++
    Blog: http://nibuthomas.com
    Posts are provided as is without warranties or guaranties.
    Tuesday, July 21, 2009 9:24 AM
    Moderator
  • I have no idea, I presume some of the MFC Feature pack libs are pulling this in?

    I'm using vs 2008.
    Tuesday, July 21, 2009 9:57 AM
  • As a followup I have found putting the following at the top of my stdafx.h


    #ifdef _DEBUG
        #define _CRTDBG_MAP_ALLOC 1
        #include "crtdbg.h"
    #endif
       

    and the following in my app constructor

    #ifdef _DEBUG
        _CrtSetDbgFlag(1);
    #endif


    results in much more debug info regarding the memory leaks. I've found some due to tooltips not been explicitly destroyed and other bits and bobs.

    Thanks
    • Marked as answer by Mark Duffill Wednesday, July 22, 2009 12:52 PM
    Wednesday, July 22, 2009 12:52 PM