memory leak detection notes (continuously updating)
Memory leak problem is very common, below is some my previous working notes: BoundsCheck BoundsCheck does not work well with mixed codes. Since my latest projects are almost all mixed, so, seldom used in my daily work. Visual studio Enable memory leak reporting There are two ways to enable memory leak check in VC, one is to define DEBUG_NEW macro, another is as below: 1: #define _CRTDBG_MAP_ALLOC 2: #include<stdlib.h> 3: #include<crtdbg.h> Then calling _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); when initializing your app. With the above changes, visual studio can dump memory block leak when quitting or between two snapshot via Windows API. For instance: c:\program files(x86)\microsoft visual studio\vc98\include\crtdbg.h(552) : {43} normal block at 0x00441C20, 40 bytes long. Data: < C > 08 02 43 00 16 00 00 00 00 00 00 00 00 00 00 00 Output mode The above output is one sample of block leak, in which, {43} is the heap block a...