Tip: I have the exact same setup, and I use earlyoom (https://github.com/rfjakob/earlyoom) to prevent this. Previously, I was frequently unable to break out of the freeze no matter how long I waited, forcing a hard reboot, but with earlyoom just a single memory-heavy app gets killed instead.