This issue seems to be quite frequent in Ubuntu. Sometimes (quite often), it happens that my Ubuntu laptop freezes completely.
This happens under heavy load: for example running two instances of IntelliJ and a Gradle build in the background.
However, I have 8GB RAM and i5 Intel running under the hood and this wasn't happening on my second computer with similar configuration and same Ubuntu version (18.04).
Could you advise, how to debug this? Once the system freezes, I cannot do anything apart from turning off the computer completely.