Just learned today, how to quickly and accurately view the memory leak, immediately use the project ~ ~ ~
Using _CrtDumpMemoryLeaks, this function in the crtdbg.h header file, the General VC + + program can be directly referenced. Crtdumpmemoryleaks () is a display of the current memory leak. Note "Current" means that when it executes, all objects that are not destroyed are reported as memory leaks. If you want to check whether the program has a memory leak, try to put this function back to the surface, if it is to check the contents of the pointer is completely released, you can write after the release ~ ~
Of course this is used in debug mode, The CRT will record the file name and line number and size of the previously allocated memory, and when it calls _CrtDumpMemoryLeaks (), it will print if it has not been released.
The results are as follows: detected memory leaks! Dumping Objects->f:\test\memleakchecker\memleakchecker\memleakchecker.cpp (): {108} normal block at 0x0003a1a8, Ten bytes long. Data: < > CD CD CD CD CD CD CD CD F:\test\memleakchecker\memleakchecker\memleakchecker.cpp ($): {107} Client Block at 0x0003a160, subtype 0, bytes long. Data: < > CD CD CD CD CD CD CD CD F:\test\memleakchecker\memleakchecker\memleakchecker.cpp (+): {106} Client Block at 0x0003a120, subtype 0, 1 bytes long. Data: < > Object dump complete. It's easy to see where the memory is allocated and not released.