15 lines
883 B
Markdown
15 lines
883 B
Markdown
# 11.2. Random crashes
|
|
|
|
> An app crashes when it is run. After running it 10 times in a debugger, you find it never crashes in the same place. The app is single threaded and only uses the C standard library. What programming errors could be crashing the crash, and how do you test each one?
|
|
|
|
Some part of the code overloads the memory or something, and it shows up randomly after some time.
|
|
|
|
## Solution
|
|
|
|
* The system could use a random variable that is not fixed in every execution.
|
|
* Uninitialized variable: in some languages, uninitialized variables take a random value
|
|
* Memory leak: the program runs out of memory Heap overflow, or corruption of data on the stack
|
|
* External dependencies
|
|
|
|
Close all other applications, track resource use very carefully. If there are parts of the program that can be disabled, do it. Run it on a different machine and see if the error persists.
|