I have a library in Ruby that shells out to get memory usage of the current process, I just received a report that it doesn't work on Windows. On mac and linux I can shell out to ps -o rss= -p 3432 to get the RSS memory for process with a PID of 3432. Is there an equivalent command in Windows?
Add a comment |
2 Answers
Not sure how linux measures RSS but in Windows for the working set size (the set of pages in the virtual address space of the process that are currently resident in physical memory) you can use WMIC to query WMI:
C:\>wmic process where processid=6884 get WorkingSetSize WorkingSetSize 253448192 (Remove get WorkingSetSize for a list of the available metrics)
2 Comments
user829755
unfortunately wmic has become an optional feature in Windows 11 and might be removed altogether in future versions.
rogerdpack
Looks like you can work around it being deprecated: stackoverflow.com/a/57607844/32453