Repolode
rfjakob

rfjakob/earlyoom

A lightweight userspace daemon for Linux that kills the largest process before the system freezes from running out of memory and swap.

Stars
4,351
Forks
215
Open issues
28
Last commit
2 days ago

What is it?

earlyoom is a small daemon for Linux that watches available memory and free swap and kills a process before the kernel's built-in OOM killer would step in. The kernel's OOM killer typically waits until the system is nearly unusable, swapping and dropping caches first. earlyoom runs in user space and checks memory up to ten times per second, using the "available" memory figure rather than "free".

By default, when both available memory and free swap fall below 10% of total, earlyoom sends SIGTERM to the process with the highest oom_score. Thresholds, a SIGKILL stage, and the choice of victim can be tuned with command-line options such as --prefer, --avoid, --ignore and --sort-by-rss. It is written in C with no dependencies and locks its memory with mlockall() so it keeps running under pressure.

It can be installed from source with make, registered as a systemd or init.d service, or installed from packages on Debian, Ubuntu, Fedora, and Arch. Optional d-bus notifications and per-kill scripts (-N and -P) let you react to kills.

Key features

  • 01Checks available memory and free swap up to 10 times per second.
  • 02Sends SIGTERM first, then SIGKILL, with configurable thresholds.
  • 03Selects victims by oom_score, or by RSS with --sort-by-rss.
  • 04Supports --prefer, --avoid and --ignore regular expressions to control targets.
  • 05Optional d-bus notifications and pre/post-kill scripts.
  • 06Written in pure C with no dependencies; includes a --dryrun mode.

Use cases

  • Keeping a desktop or laptop responsive when a browser or IDE leaks memory.
  • Protecting shared Linux servers or build machines from runaway processes.
  • Running on small-memory VMs or single-board computers where swap thrashing is common.
  • Triggering alerts or cleanup scripts whenever a process is killed for memory pressure.

Topics

FAQ

What is earlyoom?
A lightweight userspace daemon for Linux that kills the largest process before the system freezes from running out of memory and swap. earlyoom is a small daemon for Linux that watches available memory and free swap and kills a process before the kernel's built-in OOM killer would step in. The kernel's OOM killer typically waits until the system is nearly unusable, swapping and dropping caches first. earlyoom runs in user space and checks memory up to ten times per second, using the "available" memory figure rather than "free".
Is earlyoom free to use? What license does it have?
earlyoom is open source under the MIT license. Check the license terms before using it in commercial products.
Is earlyoom still maintained?
Actively maintained. The last commit to earlyoom was on Oct 19, 2026.
What can I use earlyoom for?
Keeping a desktop or laptop responsive when a browser or IDE leaks memory. Protecting shared Linux servers or build machines from runaway processes. Running on small-memory VMs or single-board computers where swap thrashing is common. Triggering alerts or cleanup scripts whenever a process is killed for memory pressure.
Where can I get earlyoom?
The source code and installation instructions are on GitHub: https://github.com/rfjakob/earlyoom

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects