After you close the C + + program, after the VS compiler's output window
The following conditions occur:
<span style= "FONT-SIZE:18PX;" >f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp (156): {930} normal block at 0x0075e3f8, bytes long. Data: < w > CF DF------------------------928} normal block at 0x0075e328, bytes long. Data: < wd u ' u > 98 CF DF-E4-E4 (926} normal block at 0x0075e278, byt Es long. Data: < > xx, xx, xx, xx, xx (925} normal block at 0x0075ef18, bytes long. Data: < > XX at the xx, xx xx xx
This situation indicates that your program has a memory leak, relying on these characters we can only know where the wrong address, but where the specific error we can not judge.
Microsoft has provided
Long _CrtSetBreakAlloc ( long Lbreakalloc);
parameters:
lbreakalloc The number of assigned orders, you can set breakpoints.
Return value: Returns the placement breakpoint setting the previous object assignment order number.
_CrtSetBreakAlloc allows applications to detect the origin of specific point memory allocations and trace back requests through interrupt execution memory leaks. function uses the allocation of the number of objects allocated in the heap when allocating memory blocks.
Example:
BOOL tmapp::initinstance ()
{
_CrtSetBreakAlloc (928);//928 is the memory address where the leak occurred
...
}
This way, when running to the 928 address value program goes into Debug breakpoint mode, we can find the location of the memory leak in the code based on the call Stack.
C + + memory detection function _CrtSetBreakAlloc ()