LINUX / A CONCEPT NOTE

Memory & Swap

what 'out of memory' means

~65 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

RAM holds active process data. When RAM is full, the OS swaps idle pages to a dedicated disk partition (Swap). If both run out, the OOM Killer terminates processes to save the system.

02 / FOLLOW THE MECHANISM

How an oom event occurs

  1. Allocation request

    a process requests memory from the kernel.

  2. Swap eviction

    kernel moves idle pages to Swap disk to free up RAM.

  3. Exhaustion

    RAM and Swap space both reach 100% capacity.

  4. OOM Killer

    kernel selects a high-resource consumer process and kills it with SIGKILL.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · REFERENCE

display free and used RAM/Swap in Megabytes

free -m

EXAMPLE 02 · REFERENCE

check if the kernel killed any process due to OOM

dmesg | grep -i oom

Explore command anatomy in the CLI lab