Electronic Arts Interview Question
Software Engineer / DevelopersTry to isolate where exactly the problem is. If it is good code and is modular, then you know which module or function is causing the crash.
Set breakpoints, debug each line and see which line is causing a problem. Using a debugger helps you view the contents of the memory you are accessing. Most crashes are caused by memory being written to without being allocated, buffer overflows, heap corruptions, etc.
As you pass through each line, see that whatever is being accessed is a legal operation.
There are some really tricky pitfalls though.
For example, using HeapAllocate() on Win32, and then writing past the end of the allocated memory does not throw an exception. But, when you try to HeapFree(), then the program crashes.
Hence, every line needs to be analysed carefully.
Different strategies for handling random crashes are
- Krishna September 07, 20111. Analyze the crash dump
2. Log the components (either in full or sparsely) and rerun the code.
3. Look for patterns like input type, time of crash or operations that happen while crashing etc.,
Most random crashes are timing issues. so enabling logs for all of them will not help all the times.