Why does restarting an app, or turning a device off and on again, often
fix a problem with it?
Software developers must try to predict every possible way in which people
might use every function of their app, and all the possible kinds of data
that might be loaded in from a file or via a network like the Internet.
Opening an app copies it from disk into memory in a known good state. But
as it is used, variables in memory change, and external data is received.
Some changes may be cumulative. The more the app is used, the further it
can drift from its initial state.
When a set of circumstances arises that the developer didn’t predict –
often because the app receives data it wasn’t designed to understand – the
app may behave unexpectedly or crash. Restarting it loads its original good
state from disk.