使用宏_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 *a = new int;
_CrtDumpMemoryLeaks();
return 1;
}
Detected memory leaks!
Dumping objects ->
{122} normal block at 0x00036660, 4 bytes long.
Data: < > CD CD CD CD
Object dump complete.
#include <iostream>
using namespace std;
#include <stdio.h>
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include "windows.h"
int main()
{
int *a = new int;
_CrtDumpMemoryLeaks();
return 1;
}
Detected memory leaks!
Dumping objects ->
{122} normal block at 0x00036660, 4 bytes long.
Data: < > CD CD CD CD
Object dump complete.
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号