本篇文章介绍了,在C++中关于Crt的内存泄漏检测的分析说明。需要的朋友参考下
尽管这个概念已经让人说滥了 ,还是想简单记录一下, 以备以后查询。
代码如下:
#ifdef _DEBUG
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif
#define _CRTDBG_MAP_ALLOC
#include
#ifdef _DEBUG
#define new DEBUG_CLIENTBLOCK
#endif
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif
#define _CRTDBG_MAP_ALLOC
#include
#ifdef _DEBUG
#define new DEBUG_CLIENTBLOCK
#endif
int _tmain(int argc, _TCHAR* argv来源gao@!dai!ma.com搞$$代^@码!网[])
{
char* p = new char();
char* pp = new char[10];
char* ppp = (char*)malloc(10);
_CrtDumpMemoryLeaks();
return 0;
}
以上就是C++中关于Crt的内存泄漏检测的分析介绍的详细内容,更多请关注gaodaima搞代码网其它相关文章!