This problems has been plaguing me for the longest time, and all I find out there are the almighty "Linux defenders" preaching that the OOM Killer is the ultimate tool ever invented. (I wonder if most of these guys even use Linux on a daily basis because their remarks sound distant to what I see in reality...)
From my experience with it (many many freezes and crashes, hard reboots and a lot of pain, hours wasted that will never get back) my understanding of the OOM Killer is that it is BROKEN, it does NOT work and it's fundamentally flawed in the way it is designed because (as original post mentions) it won't kill the main offender (the app that is allocating more memory, like Windoze does...) Instead, it kills the processes SURROUNDING the main big process, which brings no results whatsoever.
To me this Linux OOM Killer looks like something that was designed way back when computers had less than 128 MB of RAM and before internet browsers were a thing. It's unpractical and innefective to today's standards.
These commands should proove useful for you to assign to a keyboard shortcut:
First, test what process you want to kill using this command:
ps aux | grep STRING
ps aux | grep PORTION_OF_NAME_WITHOUT_QUOTES_OR_SPACES
If it shows the process you want to kill, then put it in the script below inside the parenthesis.
#!/bin/bash
#
kill -9 $(ps aux | grep type=renderer)
# the above will kill all my Chromium processes
# without having to restart my entire browser or losing progress
# incognito window will be kept alive, instead of lost
#
sudo killall tumblerd
# (optional)
Or even better:
sudo apt remove tumbler
no overcommit
option essentially does. If a process asks for too much memory, it fails. If it checks for the error, it will usually kill itself; if it doesn't, it will probably get a Segmentation Error when it tries to dereference the null pointer thatmalloc()
returns, and it will crash.