[英]What can cause an abnormal program termination?
MFC application (uses SQLite3.dll for DB access, along with other DLLs for accessing hardware) terminates abnormally. MFC应用程序(使用SQLite3.dll进行数据库访问,以及使用其他DLL访问硬件)异常终止。 There is no particular sequence of termination :( My application is a
没有特定的终止顺序:(我的应用程序是
Initially i thought it might be because of Stack Overflow , later i discovered its not. 最初我以为可能是因为Stack Overflow ,后来才发现不是。 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 提前致谢
Generally speaking, the general causes of crashes are when you: 一般而言,当机原因是:
free()
a pointer more than once free()
一个指针不止一次 Possibly 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. 也许您正在向一个硬件DLL传递错误的缓冲区,或者忘记了锁定某些内存,或者甚至在DLL及其标头之间存在版本不匹配的情况。
There are so many choices :P :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.
写入文件后,请始终刷新输出缓冲区,因为这样可以更有可能在发生异常之前将最后一行写入文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.