使用宏_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  0x00036660 4  bytes  long .
 Data: 
<      >  CD CD CD CD 
Object dump complete.


你可能感兴趣的:(内存泄露)