Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Task Manager Memory Usage

374 views
Skip to first unread message

Jon Reeves

unread,
Dec 31, 2002, 6:39:59 AM12/31/02
to
Hi,

Can someone explain how to get to the MEM Usage as shown on the
performance tab of Task Manager?
I have been looking at WorkingSetSize and PeakWorkingSetSize under
Win32_Process, but these seem to be something else.
I think the WorkingSetSize is the MEM Usage Task Manager shows in the
Processes pane, but this is _less_ than that shown on the Performance
pane. Using PeakWorkingSetSize gives a higher figure than task
manager shows.

Why the discrepancy, and what memory usage are these actually
describing ?

Torgeir Bakken (MVP)

unread,
Dec 31, 2002, 8:31:17 AM12/31/02
to
Jon Reeves wrote:

Hi

WorkingSetSize is the relevant value to compare with. You did divide the values
with 1024 to get KB? The script below gives me pretty much the same values as
the ones in Task Manager.


sComputer = "."

Set oWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")

Set colProcessList = oWMIService.ExecQuery _
("Select Name, WorkingSetSize from Win32_Process")

For Each oProcess in colProcessList
WScript.Echo oProcess.Name, oProcess.WorkingSetSize \ 1024
Next

--
torgeir
Microsoft MVP Scripting and WMI
Porsgrunn Norway


Jon Reeves

unread,
Dec 31, 2002, 9:11:59 AM12/31/02
to
Yes, I did divide them.

WorkingSet gives the same values per process as task manager shows in
the processes pane. However, if you add them all up, this comes to less
than task manager shows as mem usage under the performance tab, or do
they add up correctly for you ?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Torgeir Bakken (MVP)

unread,
Dec 31, 2002, 10:45:31 AM12/31/02
to
Jon Reeves wrote:

> Yes, I did divide them.
>
> WorkingSet gives the same values per process as task manager shows in
> the processes pane. However, if you add them all up, this comes to less
> than task manager shows as mem usage under the performance tab, or do
> they add up correctly for you ?

Hi

I misread your question the first time. To get to the physical memory values
under the Performance tab, you can use properties in the win32_operatingsystem
class.

Win32_OperatingSystem class
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_operatingsystem.asp

Here is a script that give you the "Available" and "Total" values.


s = ""
servername = "." 'use "." for local machine...
set wmi = getobject("winmgmts://" & servername & "/root/cimv2")

wql = "select * from win32_operatingsystem"
set results = wmi.execquery(wql)
for each obj in results
set os = obj:exit for
next

s = s & "FreePhysicalMemory = " & os.FreePhysicalMemory & vbcrlf
s = s & "TotalVisibleMemorySize = " & os.TotalVisibleMemorySize & vbcrlf
s = s & string(40,"=") & vbcrlf
s = s & "(Note: all memory amounts are in kilobytes)"

Available memory can be obtained from the Win32_PerfRawData_PerfOS_Memory class
also.
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_perfrawdata_perfos_memory.asp

sHostName = "."

Set Memory = GetObject("winmgmts:{impersonationLevel=impersonate}!//" _
& sHostName & "/root/cimv2:Win32_PerfRawData_PerfOS_Memory=@")

WScript.Echo "Free Memory in KB: " & Memory.AvailableKBytes

Jon Reeves

unread,
Jan 2, 2003, 5:37:46 AM1/2/03
to
> s = s & "FreePhysicalMemory = " & os.FreePhysicalMemory & vbcrlf
> s = s & "TotalVisibleMemorySize = " & os.TotalVisibleMemorySize & vbcrlf
> s = s & string(40,"=") & vbcrlf
> s = s & "(Note: all memory amounts are in kilobytes)"

OK, using these TotalVisibleMemorySize - FreePhysicalMemory gives yet
another figure for memory used. This one is sometimes more than
workingsetsize and sometimes less, but always less than the MEM Usage
on the Performance tab of task manager - this is the figure i would
like to get.

Also, is there any info anywhere on what these are actually measuring
?

Thanks
Jon

Jon Reeves

unread,
Jan 14, 2003, 11:51:41 AM1/14/03
to
So, from the deafening silence, I take it that no-one knows where
these figures come from or what they actually represent ?

Curtis Anderson

unread,
Jan 14, 2003, 5:09:36 PM1/14/03
to
Jon Reeves <mercif...@yahoo.co.uk> uttered:

> So, from the deafening silence, I take it that no-one knows where
> these figures come from or what they actually represent ?

What figures? I don't recall your earlier post. It's possible it got lost
in the never-never land that is USENET.


George

unread,
Jan 14, 2003, 5:41:31 PM1/14/03
to
You could almost write a book about lost posts on USENET and title it "Lost
in Cyberspace" :)
"Curtis Anderson" <ned...@hotmail.com> wrote in message
news:ujW#WmBvCHA.2868@TK2MSFTNGP12...

Jon Reeves

unread,
Jan 15, 2003, 5:14:47 AM1/15/03
to
> > What figures? I don't recall your earlier post. It's possible it got
> lost
> > in the never-never land that is USENET.

The previous posts in this thread between Torgeir and myself describe
several different ways of getting at memory usage through wmi - all of
these give a different figure for memory usage and none of them give
the figure I was originally after, namely the MEM Usage figure on the
performance tab of task manager.

Obviously they are all calculating memory usage slightly differently
and I was wondering what exactly the different figures represent.

Apologies if i sounded ungrateful, it just seems that trying to get
info on wmi is like trying to get blood out of a stone sometimes :(

neut...@gmail.com

unread,
Feb 23, 2015, 8:49:29 AM2/23/15
to
Hello, Jon!
Use the WorkingSetPrivate attribute of Win32_PerfRawData_PerfProc_Process WMI class.
Look this:
http://cybernetnews.com/cybernotes-windows-memory-usage-explained/

Mayayana

unread,
Feb 23, 2015, 9:58:29 AM2/23/15
to
Em terça-feira, 31 de dezembro de 2002 09:39:59 UTC-2, Jon Reeves escreveu:
> Hi,

| Hello, Jon!

Jon has been gone for 13 years. If you use a real
newsreader, instead of Google News, then you'll
be able to see the actual, current discussions.



0 new messages