These days have written the MFC program in .NET, and the DEBUG exits the dialog, there is a piece of information in the output window.
! Detected memory leaks Dumping objects -> g: /playfinalsoundusb2/2dialogdlg.cpp (144): {94} client block at 0x00035B80, subtype c0, 264 bytes long a CTextPlayer object at $ 00035B80, 264 bytes long g: / playfinalsoundusb2 /. 2Dialogdlg.cpp (138): {75} Client Block AT 0x00035550, Subtype C0, 236 BYTES Long. A CMEDIAPLAYER OBJECT AT $ 0003550, 236 BYTES Long Object Dump Complete.
I have never careded this wrong message. When I got a serious time, I turned out to be the debugging information of memory. I quickly saw the procedure, I found that I wrote the judgment in the IF judgment before Delete, . . . Hurry and change.
Check out the article, after the .CPP file is defined in the .cpp file (automatically generated), during Debug, the memory leak is checked.
#ifdef _debug #define new debug_new #undef this_file static char this_file [] = __file__; #ENDIF
In the non-MFC program, the following code can be added to the inlet of the program to perform memory leak detection: (I saw it in the article, not tested)
INT TMPFLAG = _CRTSETDBGFLAG (_CRTDBG_REPORT_FLAG); TMPFLAG | = _CRTDBG_LEAK_CHECK_DF; _CRTSETDBGFLAG (TMPFLAG);
Just starting to formally perform VC programming, is constantly learning. . . .