In my experience Firefox and Chrome use more RAM than my first 7 computers combined. Probably more than that but I'm getting away from my point. The very first thing you should do is close your browser. A command?
killall -9 firefox google-chrome google-chrome-stable chromium-browser
I've tied the most popular browsers together into one command there but obviously if you're running something else (or know you aren't using one of these) just modify the command. The killall -9 ...
is the important bit. People do get iffy about SIGKILL
(signal number 9) but browsers are extremely resilient. More than that, terminating slowly via SIGTERM
will mean the browser does a load of cleanup rubbish —which requires a burst of additional RAM— and that's something you can't afford in this situation.
If you can't get that into an already-running terminal or an Alt+F2 dialogue, consider switching to a TTY. Control + Alt + F2 will get you to TTY2 which should allow you to login (though it might be slow) and should even let you use something like htop
to debug the issue. I don't think I've ever run out of RAM to the point I couldn't get htop
up.
The long term solution involves either buying more RAM, renting it via a remote computer, or not doing what you're currently doing. I'll leave the intricate economic arguments up to you but generally speaking, RAM is cheap to buy, but if you only need a burst amount, a VPS server billed per minute, or hour is a fine choice.
make
, try-j4
for example for 4 parallel builds at a time.