Macbook Pro Hangs/Freezes sometimes
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.