Finding memory in use when balloon driver is active

When the balloon driver kicks in on a Windows VM, the <strong>Performance</strong> tab in <strong>Task Manager</strong> will show nearly all the physical memory consumed. However, adding up the memory of each of the processes shown in the process list will likely not come anywhere near the amount of physical memory consumed. You’ll be left confused as to where the memory has gone. The answer is that is has been consumed by the balloon driver, because the host the VM is located on is running out of RAM.

You can defeat the balloon driver with a memory reservation on the VM, but how do you know how much to reserve? How much is actually being consumed by the processes that are running? Here’s a piece of PowerShell that will give you a decent estimate.

foreach($p in Get-Process)
&nbsp;&nbsp;&nbsp;$mem_used = $mem_used + $p.WorkingSet
Write-Host $(([int] ($mem_used / (1024 * 1024))).ToString() + “Mb”)