Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
Memory Management
 GlobalMemoryStatus Function

  Switch on low bandwidth view
GlobalMemoryStatus Function

[GlobalMemoryStatus can return incorrect information. Use the GlobalMemoryStatusEx function instead. ]

Retrieves information about the system's current usage of both physical and virtual memory.

Syntax

C++
void WINAPI GlobalMemoryStatus(
  __out  LPMEMORYSTATUS lpBuffer
);

Parameters

lpBuffer [out]

A pointer to a MEMORYSTATUS structure. The GlobalMemoryStatus function stores information about current memory availability into this structure.

Return Value

This function does not return a value.

Remarks

On computers with more than 4 GB of memory, the GlobalMemoryStatus function can return incorrect information, reporting a value of –1 to indicate an overflow. For this reason, applications should use the GlobalMemoryStatusEx function instead.

On Intel x86 computers with more than 2 GB and less than 4 GB of memory, the GlobalMemoryStatus function will always return 2 GB in the dwTotalPhys member of the MEMORYSTATUS structure. Similarly, if the total available memory is between 2 and 4 GB, the dwAvailPhys member of the MEMORYSTATUS structure will be rounded down to 2 GB. If the executable is linked using the /LARGEADDRESSAWARE linker option, then the GlobalMemoryStatus function will return the correct amount of physical memory in both members.

The information returned by the GlobalMemoryStatus function is volatile. There is no guarantee that two sequential calls to this function will return the same information.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

GlobalMemoryStatusEx
Memory Management Functions
Memory Performance Information
MEMORYSTATUS
Virtual Address Space and Physical Storage

Send comments about this topic to Microsoft

Build date: 7/2/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
What do you mean      julean   |   Edit   |   Show History

I am supposed to use this function. where, how, etc.

I use FSX and I tell you it is tiring not to have efficient patches for at could be wonderfull game. I miss flying :-(

vb.net syntax      dmex   |   Edit   |   Show History
<DllImport("kernel32.dll", SetLastError:=True)> _
Public Shared Function GlobalMemoryStatus(<[In], Out> ByVal buffer As MEMORYSTATUS) As Boolean
End Function
Flag as ContentBug
C# syntax      dmex   |   Edit   |   Show History
[DllImport("kernel32.dll", SetLastError=true)]
internal static extern bool GlobalMemoryStatus([In, Out] MEMORYSTATUS buffer);
Tags What's this?: c# (x) syntax (x) Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker