Q: The OS memory is exhausted, but `top` and `ps` show that the sum of all running applications is only using 20% of the RAM. You clear the page cache, but the memory is still gone. Where is the "missing" memory?
If user-space processes and the page cache aren't holding the memory, it is allocated directly within the Kernel Slab Allocator. The Slab...
🛠️ Production Runbook & Step-by-Step Resolution
Production Solution & Architecture
If user-space processes and the page cache aren't holding the memory, it is allocated directly within the Kernel Slab Allocator. The Slab holds kernel structures like active dentry caches (directory paths) or inodes, or it's a literal memory leak caused by a buggy kernel driver. I would run the slabtop command. If slabtop shows the dentry cache is gigabytes in size, the server has traversed millions of tiny files recently. While normally the system reclaims this under pressure, sometimes a sysctl vm.drop_caches=3 is required to force the kernel to let go of directory structures, immediately restoring the "missing" memory.
- Immediate Triage: If user-space processes and the page cache aren't holding the memory, it is allocated directly
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.