1

I'm trying to write automation for memory leak testing of a website. I can see a memory leak by going between two pages so I have selenium automate going back and forth between them. Before the process, after each iteration of going between those pages, and after ~150 repetitions I want to know how much the memory usage of each browser changes.

Using chrome as an example I tried using tasklist | find "chrome.exe" and totaling up the memory usage output for all those processes. I'm not sure if I'm doing something wrong or if it's giving me different data than I'm thinking it's supposed to, but tasklist is giving me different numbers than Task Manager for memory usage.

Just trying it now the total memory usage between all the chrome.exe entries in tasklist showed 1259MB, but task manager shows ~530MB. Additionally after doing 150 iterations tasklist yesterday was showing ~1800MB (and memory usage had plateaued and didn't go any higher) but Task Manager was showing ~3300MB used and still going up. Closing that tab dropped chrome's memory usage in Task Manager to ~700MB. If left to run longer the browser would eventually crash, so the signs of a memory leak can't be seen using tasklist as I am, but can be seen in Task Manager.

Why are tasklist and Task Manager giving different measurements? Is there a way I can get the numbers Task Manager is providing from the command line so I can automate it? I was experimenting with https://docs.microsoft.com/en-us/windows/desktop/api/Psapi/nf-psapi-getprocessmemoryinfo but I'm not sure if it's the information I'm looking for?

0

Why are tasklist and Task Manager giving different measurements?

By default Task Manager displays the memory as "Memory - Private Working Set".

If you choose the column "Memory - Working Set" you will see the same values displayed as tasklist.

I'm running ProcessHacker (not TaskMan) so the following screen shot is slightly different but give you an indication of the difference:

enter image description here

> tasklist | find "firefox.exe"
firefox.exe                   1308 Console                    1     446952 K
firefox.exe                  10036 Console                    1      44540 K
firefox.exe                   9664 Console                    1     305092 K
firefox.exe                   9352 Console                    1     433052 K
firefox.exe                   7764 Console                    1     282256 K
firefox.exe                   2108 Console                    1     334196 K
firefox.exe                   6956 Console                    1     459480 K

See below links for more information on the difference between private memory and working set memory.


Further Reading

  • Thanks for the help! This is what I ended up using to measure it from the command line: powershell "get-process chrome | select-object @{l='Private Memory (MB)'; e={$_.privatememorysize64 / 1mb}}" – sheodox yesterday

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.