No, it sounds like you have a laptop. Desktop computers can do this when
they get too hot from clogged vents. By memory I meant the memory chips
which can go wonky and cause problems such as re-booting without asking,
freezing etc. The memory in laptops can do this too. It might be worth while
looking at it if it is overheating. You can always add extra fans and
cooling pads. Memory for laptops isn't cheap, especially if it is older. So
I hope that it isn't the case.
Something to look for would also be excessive disk caching which could point
to a memory problem. I have also had something similar happen when I have
had a drive problem. I had a usb drive that was having problems and when I
disconnected it the problem disappeared. The hard drive itself can easily be
checked with a disk utility. You need to rule things out one at a time.
It could also be a software issue, but that would affect more than just you.
If you dual boot then you can see if it is only in Ubuntu or more
widespread. You can even install another distro to a usb key and see if it
happens there. Computer problems are hard to diagnose because they are so
complex.