18

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?

2 Answers 2

13

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)

Sign up to request clarification or add additional context in comments.

2 Comments

unfortunately wmic has become an optional feature in Windows 11 and might be removed altogether in future versions.
Looks like you can work around it being deprecated: stackoverflow.com/a/57607844/32453
0

In Windows 10+ this powershell command should do it :

(Get-Process -Id 3432).WorkingSet64 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.