程序遇到運(yùn)行時(shí)異常
Windows has triggered a breakpoint in MainD.exe. This may be due to a corruption of the heap, and indicates a bug in Agistment Utility.exe or any of the DLLs it has loaded. The output window may have more diagnostic information...
HEAP[MainD.exe]: HEAP: Free Heap block 15f05f8 modified at 15f0640 after it was freed
使用BoundsCheck 查不出任何問題,可能原因是:
1. 訪問已經(jīng)被釋放的內(nèi)存
2. 再次釋放已經(jīng)被釋放過的內(nèi)存
對(duì)于第2點(diǎn),因?yàn)槲易约菏褂肧AFE_DELETE,基本不可能,google了很久,終于找到了一個(gè)MSMVP的建議.
下載Windows Debug 工具,
http://www.microsoft.com/whdc/devtools/debugging/default.mspx安裝后,使用其中的gflags.exe工具打開PageHeap,
gflags -p /enable MainD.exe /full
重新使用VS用調(diào)試方式運(yùn)行,很快就找到了出錯(cuò)位置,因?yàn)樵谀硞€(gè)靜態(tài)函數(shù)中筆誤導(dǎo)致
在編寫穩(wěn)定的服務(wù)器程序時(shí),這個(gè)工具尤為有用