I'm running Snow Leopard 10.6.8. I leave my machine for an hour. When I return the machine is asleep and all the applications have been shut down. It is almost as if it has spontaneously restarted.
Any ideas what could be causing this?
I'm not sure what is causing it, but it sounds like a hardware issue, or that the power outlet the machine is plugged into may be faulty.
You can try going to the Energy Saver preference pane and unchecking Start up automatically after a power failure. If the computer really is shutting down and restarting this may help you find out.
If it is shutting down, it may be:
If you are running Lion, you may be seeing the effects of Lion's auto kill feature. This feature automatically quits any applications that are open if they haven't been used in awhile. Try disabling it as such by typing this in Terminal:
To turn it back on:
From this answer.