2

I have the following situation - I've got a remote PC with an encrypted drive. If the PC needs a restart, I need to be physically present to enter the decryption password because I don't have any way of ssh-ing to it before the OS is loaded.

With this in mind, I use the PC to run my jupyter notebook. Only problem is, sometimes, I end up executing a piece of code which quickly consumes all available memory - 32G and then machine becomes unresponsive and that's it for my access to it.

I remember at uni, writing a C program which in a loop launched itself within itself - basically a RAM hog. The program got killed by a watchdog daemon before eating up all available memory and crashing the PC. What can I do to achieve this? Play around with ulimit? This seems too simple.

Thanks to Artem's suggestion, I found this about the solution he has proposed. Seems earlyoom will do the trick. https://www.reddit.com/r/linux/comments/d2nssy/a_userspace_outofmemory_killer_oomd_020_released/

1 Answer 1

3

My personal favorite is earlyoom (included and enabled by default in Fedora 32): https://github.com/rfjakob/earlyoom

Otherwise you can choose from:

Edit 2021-12-21:

  • Modern distros with systemd now include a built-in OOM killer called systemd-oomd, check man systemd-oomd for more details.
2
  • Thanks! Could you clarify what you mean by "Then you can choose from" - do you mean I need to install earlyoom first and then one of the other 4? It looks to me that nohang, oomd etc are similar to earlyoom.
    – s5s
    Jul 15, 2020 at 21:31
  • I meant that the first one works pretty well for me but if you don't find it satisfactory you could try the other four. :-) Jul 15, 2020 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.