?????????
??????????c++????????й???
????????
???????????easy???????????????????????????ó????new?? new[] ?? delete ?? delete[]?? malloc??calloc??free??????????????
???????:
?????????????????У???????????????????????????????????????????涯?????????????????Ч?????????????????????
????1????????????????????????????
//????????????????????????
typedef struct _tagMemoryInfo
{
    void* addr;          //?????????????
    size_t size;         //????С
    _UL lineNum;      //?????????亯?????к?
    char fileName[MAX_FILE_LEN];  //?????
}MemoryInfo;

//???????????????????????????????union????????????next????????
union FreeList
{
    FreeList* next;
    MemoryInfo data;
};
????2????????????????????????
typedef struct _tagBusyList
{
    _tagBusyList* next;
    MemoryInfo* data;
}BusyList;
????????
????1??????????vc2005???????????????????????????
????2?????????????????п???????
????3?????浱?????????????????????next??ε???濪????
???????
????1??????
#ifdef DETECT_MEMORY_LEAK
#ifndef _DETECT_MEMORY_LEAK_H_
#define _DETECT_MEMORY_LEAK_H_
typedef unsigned long _UL;
void* __cdecl operator new(unsigned int size ?? _UL lineNum ?? const char* file);
void* __cdecl operator new[](unsigned int size ?? _UL lineNum ?? const char* file);
void __cdecl operator delete(void *p);
void __cdecl operator delete [] (void *p);
void __cdecl operator delete(void *p ??  _UL lineNum ?? const char* file);
void __cdecl operator delete [] (void *p ??  _UL lineNum ?? const char* file);
void* __cdecl _DebugMalloc(size_t size ?? _UL lineNum ?? const char* file);
void* __cdecl _DebugCalloc(size_t num ?? size_t size ?? _UL lineNum ?? const char* file);
void  __cdecl _DebugFree(void* addr);
#ifndef DETECT_MEMORY_LEAK_IMPL
#define new DEBUG_NEW
#define DEBUG_NEW new(__LINE__ ?? __FILE__)
#define malloc DEBUG_MALLOC
#define DEBUG_MALLOC(x) _DebugMalloc(x ?? __LINE__ ?? __FILE__)
#define calloc DEBUG_CALLOC
#define DEBUG_CALLOC(x) _DebugCalloc(x ?? __LINE__ ?? __FILE__)
#define free DEBUG_FREE
#define DEBUG_FREE(x) _DebugFree(x)
#endif
void DumpLeakedMemoryInfo();
#endif//_DETECT_MEMORY_LEAK_H_
#endif//DETECT_MEMORY_LEAK