How would I explore and identify random crashes

I have a program which is rather large, and sometime with no warning it will just freeze. Now it doesnt crash with a spinning cursor which is the usual, no it just freezes, I can close it without any problem but cannot click anywhere.

Is there something I can do to track the source of the error?

Any SE would kill for the answer to that question. They say you spend more time maintaining a codebase than you do writing it, and a large part of that is undoubtedly fixing “random” crashes.

So, where would I start?
Try to reproduce the crash consistently. Be careful and observant. Take notes even.

(hopefully) Once you’re able to consistently reproduce the crash, it’s time to run the debugger. (There’s plenty of great resources on using debuggers, regardless of IDE, go check em out). What you’re trying to do is find the section of code where it fails.

This part is, in my experience, more of an art. If I can say anything it’s this: it’s gonna take time. Not really any shortcuts.

Is the crash throwing anything into the console?

1 Like

nothing, at all … just blank.

Thanks I shall look into debuggers and see if I can isolate the problem.

Freeze can be an infinite loop. If nothing happens it could be initiated from draw() or any function draw() calls. As @tony said reproducing the error is the first thing to do, otherwise it needs dumb luck to find the problem.

1 Like