.NET High Container Memory Usage Leading to K8s OOMKill (Server GC)
Server GC defaults to high heap thresholds on multi-core hosts inside small containers.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: .NET High Container Memory Usage Leading to K8s OOMKill (Server GC)
Platform: DotNet
Common Root Causes:
- Server GC defaults to high heap thresholds on multi-core hosts inside small containers.
Interactive Diagnostic Checklist
Verified Solutions:
- Set `DOTNET_GCHeapHardLimitPercent=75` or enable `DOTNET_GCServer=0` for small containers.
Safe Diagnostic Command:
env | grep DOTNET_GC
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Server GC defaults to high heap thresholds on multi-core hosts inside small containers. Recommended diagnostic: `env | grep DOTNET_GC`. Remediation: Set `DOTNET_GCHeapHardLimitPercent=75` or enable `DOTNET_GCServer=0` for small containers.
Worked Examples
- Run `env | grep DOTNET_GC` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-dotnet-gc-server-memory-container · Independently verified: 2026-11-25