This is what it looks like on top:
To get that free memory I had to kill Android Studio. Chrome is definitely using the most memory, but also Firefox. I keep both open most of the day doing different things. I've been doing that plus Android Studio for years and never had an issue until recently. The only thing I've changed recently is I upgraded to Ubuntu 18.10. I noticed the buff/cache is really high, should it really be using that much when I'm running out of memory for applications and having to swap?
Edit: In the end it turned out that I had a couple of problems. The swap file was tiny but once I fixed that it would just take longer to run out of memory. Then I found out the Google Play Music Chrome extension was using a lot of memory, removing it fixed the issue.