Three possible reasons. (Freezing implies either actual freezing or a BSOD)
1. Your CPU fan is dirty and your PC freezes/restarts as a safety precaution so your CPU doesn't get fried.
2. Same as above, but with GPU instead of CPU.
3. One of your RAM modules has a corrupted section. While this usually causes restarts right after the boot-up screen, it's also possible that your PC freezes suddenly.
4. The least likely is that the RAM module slot was actually damaged.
Possible solutions:
1. Open up your PC, dismount the fan, clean it. Vacuum cleaner and some tissues will do the trick. You don't even need wet tissues, dry tissues are usually just fine.
2. Same as above just with your graphics card.
3. If you have more than one RAM module, try removing one of them and using your PC like that to find the faulty module. If you have only one, try asking a friend if you can switch for a couple of days to see how it works out.
4. Same as above. If you have a faulty RAM slot, you should figure it out very quickly.