Site icon New Generation Enterprise Linux

See which process is leaking memory into your cgroups

Container Basics On Linux (Namespaces/Cgroups)

See which process is leaking memory into your cgroups

🧩 The Challenge

Dealing with a container that keeps getting killed by the OOM killer even though top says it has plenty of memory is a special kind of hell. You end up staring at memory stats for hours because the container runtime is hiding the real usage from you.

💡 The Fix

Dig into the memory.stat file directly inside the cgroup filesystem to see the hard numbers the kernel is actually tracking. It bypasses the abstractions that usually lie to you.

cat /sys/fs/cgroup/memory/system.slice/docker-<container_id>.scope/memory.stat | grep -E 'cache|rss|usage'

⚙️ Why It Works

This pulls the raw accounting data straight from the kernel rather than relying on tools that might interpret the container environment incorrectly. Because the kernel tracks memory usage by page type in real-time, this shows you exactly what’s driving the memory pressure.

🚀 Pro-Tip: Use memory.failcnt to see if you’ve actually hit your limit recently.

Linux Tips & Tricks | © ngelinux.com | 9/17/2026

0 0 votes
Article Rating
Exit mobile version