????2.2 ????C?????????????й?

????VC++??C???п?CRT??????????????????????????й???CRT????_CrtMemCheckPoint??_CrtDump MemoryLeaks??_CrtSetDbgFlag??????????????????й???

?????????MFC?????? ???????Ч?????й????湦??? ????????????????

??????1????StdAfx.h???????????′????????????/Yu ???

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK?? THIS_FILE?? __LINE__)


??????2??????????.cpp?????????????????????

#include "stdafx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


??????3??????????????????????й???????

????_CrtSetDbgFlag??_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF????

????????MFC????? MFC???????????????? ????????????.cpp???????????????????2??????????

???????Щ????£??????????????й????????е??????????????????????????????????????????????????????????????????????????????_CLIENT_ BLOCK????????棬??????_CrtSetDumpClient????????????????????????????????????????CObject??е????????

??????1????????/?????????????????????ο?crtdbg.h????

??????2???????????????????????new?????void* __cdecl operator new??size_t nSize?? int nType?? LPCSTR lpszFileName?? int nLine?????ο?MFC????? afxmem.cpp????????nType???????????????

??????3?????????????????????????????????????????????????д???????????dbgint.h????

??????4??????_CrtSetDumpClient?????????????????????????ο?MFC?????dumpinit.cpp????

?????????CObject?????????MFC ?????????????????????????????ο?MFC????? afxmem.cpp??dumpinit.cpp???????Ч?????CObject??е???????????1?????????CObject??е????????麯??Dump????2???????????????? ??????? afxDump.SetDepth??1????????????????

????2.3 ????Purify??Insure++???????????????

????Rational Purify??Parasoft Insure++ ??????????????????????Purify?????????????????/д?????δ?????????棬?????????????ж?/д?????й????Insure++??????????????????????????????????????????????????????????????????????к???й???????????????????98???и??????????C++????????????????Σ???Insure++ 6.1?????????