I bought a new S5 last week and right out of the box it would reset itself every 4-6 hours at first then every hour or more often.
It did not matter what apps were on, it reset itself even at night. Wifi-off, location-off, factory reset, clean cache, no memory card in it, pull battery out...