I had this in Gnome about a year ago, and it was a Gnome memory leak by an extension causing it.
Been a constant experience for me from 2001 when I first started using.
I think even quantifying memory pressure on Linux is relatively new
https://www.phoronix.com/scan.php?page=news_item&px=Linux-Do...
macOS' behavior under high memory pressure is much more graceful IME