现在的位置: 首页 > 综合 > 正文

内存泄露检测类

2019年03月19日 ⁄ 综合 ⁄ 共 299字 ⁄ 字号 评论关闭
#pragma once

#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif

class CMemoryLeak
{
public:
    CMemoryLeak()
    {
        _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
    }

    virtual ~CMemoryLeak()
    {

    }
};

抱歉!评论已关闭.