过程是这样的,在vc debug的过程中,突然弹出了一个assert窗口:
Windows has triggered a breakpoint in cs.exe.
This may be due to a corruption of the heap, which indicates a bug in cs.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while cs.exe has focus.
查看output输出:
Heap missing last entry in committed range near e664630
Windows has triggered a breakpoint in cs.exe.
This may be due to a corruption of the heap, which indicates a bug in cs.exe or any of the DLLs it has loaded.
不废话,直接查看该内存是什么:
0x0E664630 0e 00 0f 00 59 03 10 04 aa aa cd ab 00 10 72 85 38 00
看不出什么,往上再看看:
0x0E66460C 07 e2 04 00 a8 01 66 0e 01 00 cd cd fd fd fd fd....
看来这就是块堆内存,实在看不出什么,决定暂时忽略. 过了几天,该错误没有再出现过.
但就在交付程序前一天测试中,又出现了这个错误.看来一颗定时炸弹是埋藏在了程序中.必须找出来,否则后果很严重.
首先要做的就是要重现这个问题,如果每次碰巧遇到这个问题的话,实在无从下手.从症状来看,是个典型的Heap Corrup