<p>I have a container with a dotnet core application running in Azure Kubernetes Service. No memory limits were specified in Pod specs.</p>
<p>The question is why GC.GetTotalMemory(false) shows approx. 3 Gb of memory used while AKS Insights shows 9.5 GB for this Pod container?</p>
<p><a href="https://i.stack.imgur.com/rRBa9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rRBa9.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/nmVD4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nmVD4.png" alt="enter image description here" /></a></p>
<p>Running <code>top</code> reveals these 9.5 GB:
<a href="https://i.stack.imgur.com/rATs5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rATs5.png" alt="enter image description here" /></a></p>

<p>As I understand <code>GC.GetTotalMemory(false)</code> returns the size of managed objects in bytes but the entire working memory set is much larger because memory is allocated in pages and because of managed heap fragmentation and because GC is not performed.</p>
