vc2005的诡异错误“Windows has triggered a breakpoint in .exe.”

vc2005的诡异错误“Windows has triggered a breakpoint in .exe.”

笔记 2009-12-30 15:00:13 阅读113 评论0 字号:

问题描述:
在调试模式下出现如下问题
Windows has triggered a breakpoint in .exe.
This may be due to a corruption of the heap, and indicates a bug in .exe or any of the DLLs it has loaded.
The output window may have more diagnostic information

用VC总是会出现这些千奇百怪的问题,上述问题看起来是多线程中某个线程释放内存导致的错误,诡异的是,同样一个程序,用来跑第一批数据的时候顺利地出了结果,第二批数据的时候总是在第33个数据上弹出上述窗口,而且两批数据的数据量也都是3000多,真是让人咋舌。然而,更诡异的是,出现上述窗口后,强制选“continue”,竟然还能继续运行,得到正确的结果。。。。。。

无奈的是,出错的程序并不是我写的,而且藏在dll里面我也看不到,只好硬着头皮每次弹出窗口都点“continue”,希望最终能够得到全部正确的结果吧。

感想:VC实在是个艰深难懂的东西,可是又不得不用它,吃一堑长一智,以后自己写程序的时候尽量规范一点,能做的就只有这些了Q_Q

以下是从网络上摘录的关于这个问题的描述:
1. It was a problem of porting and not memory delete..!!
2. 程序不正常不是由CString对象引起的,而是由工作线程中一个堆内存释放写错了位置引起的。
3. 在release模式程序运行 一切正常
4. malloc时把Size+1,保证末尾有'\0'
5. I met the same problem. I tried manually, and found this snap in is the
problem for my systgem. After rename it in the
HKLM\software\microsoft\mmc\SnapIns, the problem is gone.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}]
@="SqlcmSnapin"
"NameString"="SQL Server Configuration Manager"
"NameStringIndirect"="@c:\\Program Files\\Microsoft SQL
Server\\90\\Tools\\binn\\SqlManager.dll,-3"
"About"="{56563bd1-5f42-43a8-abed-3c2a4328e8c1}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}\NodeTypes]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}\NodeTypes\{7f34670d-2d94-48e4-a88a-65c7ed5ae528}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}\NodeTypes\{f39767e2-8f58-11d9-b89d-505054503030}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}\NodeTypes\{f39767e7-8f58-11d9-b89d-505054503030}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}\NodeTypes\{f39767e8-8f58-11d9-b89d-505054503030}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\ {ca9f8727-31df-41d2-975c-887d84903967}\StandAlone]

6. 刚刚找到原因了。到微软的网站找了一个调试工具,可以帮助发现heap错误。网址如下:http://www.microsoft.com/whdc/devtools/debugging/default.mspx

你可能感兴趣的:(vc2005的诡异错误“Windows has triggered a breakpoint in .exe.”)