What can cause an abnormal program termination?
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 ge开发者_运维知识库neral 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:
- read memory that isn't yours
- write memory that isn't yours
- divide by zero
- do something inside an interrupt that you shouldn't
free()
a pointer more than once
Possibly also:
- have an unhanded exception
- found a bug in your MFC
- one of your >6 hardware-access DLLs is doing any of the above
- You are encountering some kind of hardware fault
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.
精彩评论