01 · Why it’s true
Each process sees its own private address space. The CPU translates every virtual address to a physical page using page tables the kernel maintains, so processes can’t see each other’s memory.
Physical memory is only assigned when a page is first touched. That’s why a process’s virtual size (VSZ) is often much larger than its resident memory (RSS). When RAM runs short, the kernel first reclaims page cache, may swap, and — as a last resort, or when a container hits its memory limit — the OOM killer ends a process.
02 · Picture it
03 · In the interview
- “Why is free memory nearly zero?” — page cache uses spare RAM and gives it back when needed.
- VSZ versus RSS, and which one to watch.
- Diagnosing OOM kills in containers.
04 · Practice question
“A container was OOM-killed, but the application’s own memory metrics were well under the limit. How?”
A strong answer covers
- Confirm the kernel killed it: exit code 137 and an out-of-memory message in the kernel log.
- The container’s limit counts everything charged to it — not just the heap the app reports: thread stacks, native buffers, other processes, tmpfs files.
- Compare RSS and the cgroup’s memory statistics with what the app reports to find the gap.
- Look at growth over time (leak) versus spikes with load, then fix the cause or resize the limit with headroom.
Want to play with it? Open the interactive deep dive →