earlyoom - A Simple OOM Killer

This section provides a tutorial example on how to install 'earlyoom' to prevent OOM (Out Of Memory) freeze.

What Is "earlyoom"? - "earlyoom" is a simple, stable and tiny OOM (Out Of Memory) killer written in C language.

Some how there is no OOM killer included in my Ubuntu computer. When I use Firefox and open multiple tabs to browse the Internet, the system freezes frequently. The only way to free the computer is to press "Alt-PrtSc-S.U.B" for a reboot.

My computer only has 4 GB of RAM, which runs into OOM (Out Of Memory) when Firefox launches multiple processes to support Web browsing activities. By default, Ubuntu should run an OOM killer in the background to detect OOM and kill some running processes to prevent system freeze.

But for some reason, there is no OOM killer running on computer. So I installed "earlyoom" as described below.

1. Install and run "earlyoom".

herong$ sudo apt install earlyoom

herong$ sudo systemctl enable --now earlyoom

2. Make sure that "earlyoom" is running.

herong$ sudo systemctl status earlyoom

● earlyoom.service - Early OOM Daemon
   Loaded: loaded (/lib/systemd/system/earlyoom.service; enabled; ...
   Active: active (running) since Sun 2025-12-14 16:27:41 EST; ...

3. Stress test the system by running Firefox with many tabs open to play YouTube in each of them.

4. A few moments later, one of Firefox tabs crushed. "earlyoom" killed its sub-process.

5. Search the system log file. I see the OOM killing message.

 
herong $ grep oom /var/log/syslog'
  ...
  ubuntu earlyoom[10287]: Out of memory! avail: 345 MiB < min: 362 MiB
  ubuntu earlyoom[10287]: Killing process 11260 Isolated Web Co

Cool. "earlyoom" successfully killed a process and prevented an OOM freeze.

Table of Contents

 About This Book

 Introduction to Ubuntu Systems

 GNOME - Desktop Interface and Environment

 Shell - The Command-Line Interpreter

 Process Management

Memory Management

 Layers of Memory and Access Speed

 List CPU Caches and Their Sizes

 Virtual Memory vs. Physical Memory

 Buffer Memory and Cache Memory

 Verify Cache Memory with "cp" Command

 What Is Swap Space

 Virtual Memory Mapping and Page Table

 "ps -o rss,drs,trs,vsz,sz" - Process Status Options

 smem - Process Memory Usage Report

 pmap - Process Memory Map

 /proc/{id}/maps - Process Memory Map

 /proc/{id}/smaps - Process Memory Map Details

earlyoom - A Simple OOM Killer

 Files and Directories

 APT (Advanced Package Tool)

 Network Connection on Ubuntu

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Administrative Tasks

 References

 Full Version in PDF/EPUB