Linux has an Out Of memory killer (oom_klller)
Currently, The oom-killer does not seem to work, In Puppy and in other linux distros.
You can try to configure it so that it works better. Search the net for oom killer, oom_kill_allocating_task etc etc.
Or you can try earlyoom - Early OOM Daemon for Linux
https://github.com/rfjakob/earlyoom
For Debian 10+ and Ubuntu 18.04+, there's a Debian package
So I downloaded a precompiled 64 bit .deb from https://packages.debian.org/sid/amd64/earlyoom/download
i unzipped it, put it in /root/my-applications/bin/ ( /usr/bin/ would also work )
It's a single executable file, 34k.
I ran it in a text terminal (console) earlyoom -r 0 & disown
It seems to run properly.
It causes tail /dev/zero
to be killed.
In BionicPuP64, anyway.
A good place to start it from automatically at boot might be /etc/rc.d/rc.local
Paste something like earlyoom -pr0 --avoid 'Xorg' --prefer 'firefox-bin' & disown
into /etc/rc.d/rc.local
EDIT: Lately, I've been running earlyoom with these parameters (I have no swap):
earlyoom -r0 -m2 --avoid Xorg
It should kill the process using large amounts of ram, and prevent the operating system from crashing.
It uses about 200k of ram when running.
https://github.com/rfjakob/earlyoom
http://manpages.ubuntu.com/manpages/bio ... oom.1.html
https://pkgs.org/download/earlyoom
https://en.wikipedia.org/wiki/Out-of-memory
PPS This is what --prefer and --avoid match to: cat /proc/[0-9]*/stat | awk '{print $2}'
EDIT: attached earlyoom 1.6.2 64 bit pet, compiled in BionicPup64 8.0