2
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?
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 – 2019-03-21T15:11:01.400