使用宏_CRTDBG_MAP_ALLOC 查找程序内存泄露

代码
#include "stdafx.h"
#include 
<iostream>
using namespace std;

#include 
<stdio.h>

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

#include 
"windows.h"


int main()
{
    
int *= new int;
    _CrtDumpMemoryLeaks();
    
return 1;
}

Detected memory leaks
!
Dumping objects 
->
{
122} normal block at 0x000366604 bytes long.
 Data: 
<    > CD CD CD CD 
Object dump complete.


原文地址:https://www.cnblogs.com/chengxin1982/p/1841699.html