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

Has GlobalMemoryStatusEx been fixed ?

1 view
Skip to first unread message

sid

unread,
Nov 28, 2005, 2:10:56 PM11/28/05
to
In a thread last year:

http://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/485840765d223a9c/9717dffc4e9747fa?lnk=st&q=GlobalMemoryStatusEx&rnum=1&hl=en#9717dffc4e9747fa

Statements were made to the fact that this function returned the wrong
numbers.

I wanted to know if this has been addressed or is the function correct
as it is ?

I need to be able to retrieve the "Commit Charge" and display it much
the same way that the Task-Manager does. Does anyone know how to
calculate "Commit Charge" from what the present version of
"GlobalMemoryStatusEx" returns.

Thanks

Sid.

Kellie Fitton

unread,
Nov 28, 2005, 3:05:20 PM11/28/05
to
Hi,

Commit charges are the total virtual address space allocated to
all the processes and the operating system as well, however, you
can use the API VirtualQueryEx() to get information about a range
of pages within the virtual address space of a specified process.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/virtualqueryex.asp

Hope these information helps,

Kellie.

Arkady Frenkel

unread,
Nov 29, 2005, 1:51:33 AM11/29/05
to
I'm not sure if you can receive that from GlobalMemoryStatusEx but check
performance counters
( in Performance monitor that object "Memory" , counters : "Commited bytes"
or "% Commited bytes in use" )
Arkady

"sid" <sidw...@alexian.net> wrote in message
news:1133205056....@z14g2000cwz.googlegroups.com...

Ivan Stambuk

unread,
Nov 29, 2005, 5:27:46 PM11/29/05
to
You can get commit charge with
NtQuerySystemInformation/SystemPerformanceInformation, in
SYSTEM_PERFORMANCE_INFORMATION.CommittedPages. You can multiply this
number with PAGE_SIZE (4K for small pages on x32, although this number
can be obtained with NtQuerySystemInformation/SystemBasicInformation in
SYSTEM_BASIC_INFORMATION.PageSize).

The proper, win32 way, would be using GetSystemInfo for page size.
Dunno how to get MmTotalCommittedPages in win32, maybe someone else
does.

Pavel Lebedinsky [MSFT]

unread,
Dec 12, 2005, 9:37:05 PM12/12/05
to
"sid" wrote:

> In a thread last year:
> http://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/485840765d223a9c/9717dffc4e9747fa?lnk=st&q=GlobalMemoryStatusEx&rnum=1&hl=en#9717dffc4e9747fa
>
> Statements were made to the fact that this function returned the wrong
> numbers.
>
> I wanted to know if this has been addressed or is the function correct
> as it is ?

As far as I can tell, ullTotalPhys reports the right value. It gets this
value from the MmNumberOfPhysicalPages kernel variable, which
is always measured in small pages.

MmNumberOfPhysicalPages can be smaller than the total amount
of RAM installed, but this is probably because some areas are
reserved for use by hardware (or things like the /burnmem switch)
and are not accessible to the OS.

--
This posting is provided "AS IS" with no warranties, and confers no
rights.


Pavel Lebedinsky [MSFT]

unread,
Dec 14, 2005, 9:49:20 PM12/14/05
to
"Ivan Stambuk" wrote:

> Dunno how to get MmTotalCommittedPages in win32, maybe someone else
> does.

GetPerformanceInfo/CommitTotal is the only way I know.

0 new messages