I'm running Ubuntu 20.04 on a Lenovo X1C 7th Gen with 16GB RAM. The swap is set to 2GiB.
Just after entering edit mode on a photo in Google Photos (in Firefox), which I'm pretty sure has a serious memory leak (because I've seen it increase memory consumption and slow down the system), the system froze like this:
It stayed like that for a good 3 minutes, with the mouse cursor barely dragging along (good luck taking a screenshot). Eventually it recovered. As you can see, there was plenty of RAM available.
What was going on, and how can I prevent this? /proc/sys/vm/swappiness
is the default, 60.