Lies Programmers Believe about Memory
summary
Claim: malloc doesn't allocate RAM — Linux overcommits and uses demand paging so physical pages appear only on page faults. Freeing often only returns memory to the allocator, not the kernel, so RSS lies. Cgroup v2 features used: memory.low protection and memory.max limits; swap prevents binary out‑of‑memory cliffs. Built and used Senpai (uses PSI + memory.high) to probe working sets; example kernel build peaks ~800 MB, runs fine at 400 MB but fails at 300 MB, Senpai reports ~340 MB needed.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 1:19Memory Management Goals
- 2:17Overcommit and Paging
- 6:32Virtual Memory Mechanics
- 7:57Allocating Memory
- 11:03Freeing Memory
- 14:22DRAM and Caches
- 19:57Memory Types and Metrics
- 22:42Cgroups and Limits
- 26:43Memory Protection
- 29:07In Defense of Swap
- 32:21Measuring True Usage
- 36:45Senpai Tool
- 39:36Conclusion
related talks
26mLet's demystify memory
39mMM101: Introduction to Linux Memory Management
41mAre you out of memory, or have plenty to spare?
01h 36mLinux Memory Management and Containers
40mInspecting and Optimizing Memory Usage in Linux
51mIntroduction to Memory Management in Linux
01h 36mTutorial: Linux Memory Management and Containers
44mLarge Pages in Linux
