High memory consumption on a Windows VM can lead to severe performance degradation, application failures, and system unresponsiveness. To address memory exhaustion, it is critical to capture specific diagnostic data while the issue is occurring. This article outlines the step-by-step procedure to collect the data that will be helpful in investigating Windows memory issues. These artifacts are essential for identifying whether the root cause is a driver memory leak, application resource exhaustion, or OS-level contention. The steps in this article are suited for Windows VMs in a TAS or TKGI deployment.
VMware Tanzu Application Service
VMware Tanzu Kubernetes Grid Integrated Edition
Steps:
bosh -d $DEPLOYMENT ssh $WINDOWS-INSTANCE
powershell
systeminfo | findstr /C:"Memory" > C:\var\vcap\sys\log\systeminfo.txt
tasklist > C:\var\vcap\sys\log\tasklist.txt
Get-Process | Sort-Object -Property VirtualMemorySize -Descending | Select-Object ProcessName, VirtualMemorySize, PrivateMemorySize, WorkingSet, PagedMemorySize, NonpagedSystemMemorySize, PeakWorkingSet, PeakPagedMemorySize, HandleCount > C:\var\vcap\sys\log\get-process-vmemsize.txt
Get-Process | Sort-Object WorkingSet -Descending | Select-Object Id, Name, WorkingSet, WS, PM, VirtualMemorySize, PagedMemorySize64 > C:\var\vcap\sys\log\get-process-workingset.txt
Get-Counter '\Memory\*' > C:\var\vcap\sys\log\get-counter-memory.txt
Get-Counter '\Paging File(*)\% Usage' > C:\var\vcap\sys\log\get-counter-paging.txt
& 'C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe' stat balloon > C:\var\vcap\sys\log\vmwtb-stat-balloon.txt
bosh -d $DEPLOYMENT logs $WINDOWS-INSTANCE
The log bundle can then be uploaded to a support case accordingly. The output files can be reviewed to identify where the physical memory is being used. Note that the files need to be converted to ASCII text format so that Linux commands like grep can parse them successfully.
To get a rough breakdown of the physical memory based on the output files, fill out the following table. The categorization in the table is based on an external article "Physical Memory: Where did all of the physical memory go?".
| Category | Usage (GB) | Notes |
| Process working set memory | From the "get-process-workingset.txt" or "get-process-vmemsize.txt" file. Parse (e.g., grep) for the values of "WorkingSet" and sum the values up. | |
| Kernel pool memory | From the "get-counter-memory.txt" file (\memory\pool nonpaged bytes + \memory\pool paged resident bytes) | |
| System cache | From the "get-counter-memory.txt" file (\memory\system cache resident bytes) | |
| Driver locked | From the "vmwtb-stat-balloon.txt" file | |
| Address windowing extensions (AWE) | Can be collected from a GUI tool named "RamMap". If the above 4 categories have accounted for most of the used memory, then this might be trivial and can be skipped. Otherwise, download and use "RamMap" to gather more information. |
The total of the "Usage (GB)" column should give a value that is close to the value of used physical memory. Subtract this value from the "Total Physical Memory" value (from the "systeminfo.txt" file), and the difference should be close to the "Available Physical Memory" value (from the "systeminfo.txt" file), and if so then it should be safe to presume that the above table closely represents how the physical memory is being used.
If the "Process working set memory" usage is high, the "tasklist.txt" and "get-process-workingset.txt" files can be reviewed to identify which process is consuming much of the physical memory.
If the "Kernel pool memory" usage is high, then a driver could be the culprit. To get more information, use "PoolMon" to identify the specific driver using the most memory.
If the "System cache" usage is high, then a process or a driver could be doing a continuous and high volume of cached read requests. See the Microsoft document that describes a "System File Cache Issue".
If the "Driver locked" is high, then check the particular ESXi host for memory pressure.
Other useful tools to gather more diagnostics:
# run the following commands from the folder where poolmon is saved.
cd C:\tmp
.\poolmon.exe /b /n C:\var\vcap\sys\log\poolmon-b-out.txt
.\poolmon.exe /p /p /b /n C:\var\vcap\sys\log\poolmon-ppb-out.txt