Skip to content
Preptima
hardScenarioConceptSeniorStaffLead

Your .NET service keeps getting OOM-killed in its container while the GC reports a small heap. Where has the memory gone?

6 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

The kernel kills you on everything in the cgroup, while the GC only reports the managed heap. Committed-but-empty heap, per-core Server GC heaps, thread stacks, native buffers and loaded code all count against the limit and none of them appear in a heap size figure.

Was this answer helpful?

Likely follow-ups

  • The live heap shrinks and resident memory does not. What is holding those pages, and what would release them?
  • You set the CPU limit to 500m and the heap count did not change. Where does the GC get its core count from?
  • How do you tell a leak from a heap that is merely allowed to grow?
  • Which of these symptoms changes under Workstation GC, and what do you give up for it?

Related questions

Further reading