程序遇到運行時異常
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. 訪問已經被釋放的內存
2. 再次釋放已經被釋放過的內存
對于第2點,因為我自己使用SAFE_DELETE,基本不可能,google了很久,終于找到了一個MSMVP的建議.
下載Windows Debug 工具,
http://www.microsoft.com/whdc/devtools/debugging/default.mspx安裝后,使用其中的gflags.exe工具打開PageHeap,
gflags -p /enable MainD.exe /full
重新使用VS用調試方式運行,很快就找到了出錯位置,因為在某個靜態函數中筆誤導致
在編寫穩定的服務器程序時,這個工具尤為有用