While developing some software, a program under test sometimes eats all the memory, then proceeds to yomp into the swap space and start thrashing the disk, leading to a predictable drop in responsiveness to the point that I generally switch to another terminal to log in and kill the process manually.
What I'd like is for this particular process to get killed before it starts eating swap space like there's no tomorrow. I found a github page in which killing processes with a watchdog is discussed (and indeed, done) - https://github.com/rfjakob/earlyoom - and I could alter that code a little to seek out and kill only this specific faulty program, but it would be nice if I could simply deny use of swap space to a nominated process and have it simply get killed. I suppose even more awkwardly, it's be fine for it to get a small amount of swap space in the normal course of things; it's only when it's on a quest to consume all the memory in the universe that it needs killing.