什么会导致程序异常终止?
MFC 应用程序(使用 SQLite3.dll 进行数据库访问,以及其他 DLL 来访问硬件)异常终止。没有特定的终止顺序:( 我的应用程序是
- 单线程应用程序
- 使用异常处理
- 使用超过 6 个 DLL 来访问不同的硬件
- 在 WinXP SP2 上运行
最初我认为这可能是因为 Stack Overflow,后来我发现不是。有人能告诉我程序异常终止的一般原因是什么吗?如果有人遇到过类似的问题或者有任何提示或线索,请传递。
提前致谢
MFC application (uses SQLite3.dll for DB access, along with other DLLs for accessing hardware) terminates abnormally. There is no particular sequence of termination :(
My application is a
- Single threaded Application
- Uses exception handling
- Uses more than 6 DLLs to access different hardwares
- Runs on WinXP SP2
Initially i thought it might be because of Stack Overflow, later i discovered its not. Can someone tell me what are all the general causes for an abnormal program termination? If someone has come across similar problems or has any hints or clues, please pass them on.
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说,崩溃的一般原因是当您执行以下操作时:
free()
的操作不止一次指针也可能:
也许您将错误的缓冲区传递给硬件 DLL 之一,或者忘记锁定某些内存,或者甚至可能在 DLL 及其标头之间存在版本不匹配。
有很多选择:P
Generally speaking, the general causes of crashes are when you:
free()
a pointer more than oncePossibly also:
Maybe you're passing a bad buffer to one of your hardware DLLs, or are forgetting to lock some memory, or you could even have a version mismatch between the DLLs and their headers.
There are so many choices :P
由于这是一个运行时问题,我建议您将调试语句发送到日志文件。包括函数名称,也许还有时间戳。写入文件后始终刷新输出缓冲区,因为这提供了在异常发生之前将最后一行写入文件的更好可能性。
Since this is a run-time issue, I suggest you send debug statements to a log file. Include the function name and perhaps a timestamp. Always flush the output buffer after writing to the file, as this provides better probability that the last line was written to the file before the exception occurs.