OOM killer 🐧 Linux

Killed / Out of memory: Killed process (Linux OOM killer)

The kernel ran out of memory and killed a process to recover — the program just prints “Killed” (exit code 137).

Seen on: Linux

Meaning

When RAM and swap are exhausted, the OOM killer picks the biggest process and sends SIGKILL. There’s no stack trace; the evidence is in the kernel log. Small VPSs without swap hit this during builds (npm, Composer, webpack) and database spikes.

Common causes

  • Server has too little RAM / no swap
  • Memory-hungry build steps (webpack, tsc, Composer)
  • Memory leak in a long-running process
  • Too many worker processes (PHP-FPM, Gunicorn) for the RAM

⚡ Quick fix

  1. Confirm: dmesg -T | grep -i -E "killed process|oom"
  2. Add swap on small servers
  3. Reduce workers / limit process memory
  4. Build on CI instead of the production server

Detailed fix by platform

Linux

  1. Add a 2 GB swap file:
    bash
    sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile
    sudo mkswap /swapfile && sudo swapon /swapfile
    echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
    free -h

How to diagnose

  1. Kernel log — dmesg / journalctl -k for OOM entries
  2. Victim — Which process and how big?
  3. Capacity — RAM, swap, worker counts

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.