I don't turn off my MacBook Pro very often, and sometimes it just freezes and restarts itself after a few seconds. Its very annoying, especially when I'm working on something. I contacted support a few times and I did everything they said, and recently I started monitoring my memory usage and I noticed that Safari is taking a lot of memory, so I started to restart Safari when I see that its eating up my memory. My MacBook started acting better until just now. While I was waiting for it to restart it self, I saw that the memory levels were ok. So I'm wondering, is there any way I can see the history of Activity Monitor? Or is there any log I can check to see what the error is?
High memory usage is not a reason for a machine to randomly restart, but if you say the memory usage has an effect on the frequency of it happening, the issue might be a defective RAM. There are several tools to test your RAM, a free example would be MemTest86.
I had the same issue on my MacBook Pro (Retina, 15-inch, Early 2013). At random occasions, it would lock up for a few seconds and more often than not restart or shutdown after that.
There was no kernel panic report. No obvious error in console logs. Hardware tests at the Apple Store found no problems.
I recently came to the conculsion that this is triggered by Oracle’s version of Java. I had completely uninstalled Java and had no crashes in months. I did not yet suspect Java to be the culprit. I assumed a OS X update had fixed the problem. Then I re-installed the Java SDK because I needed it for a project. In the week after I installed Java, I had 4 sudden reboots. None in the weeks since I again uninstalled Java.
Uninstall Java: https://www.java.com/en/download/help/mac_uninstall_java.xml
I have reported the problem to Apple. Radar bug report #26992850.