The GlobalMemoryStatus function obtains information about the system's current usage of both physical and virtual memory.
To obtain information about the extended portion of the virtual address space, or if your application may run on computers with more than 4 GB of main memory, use the GlobalMemoryStatusEx function.
You can use the GlobalMemoryStatus function to determine how much memory your application can allocate without severely impacting other applications.
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.
On computers with more than 4 GB of memory, the GlobalMemoryStatus function can return incorrect information. Windows 2000 and later report a value of -1 to indicate an overflow. Earlier versions of Windows NT report a value that is the real amount of memory, modulo 4 GB. For this reason, 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 TotalPhys member of the Kernel.MEMORYSTATUS structure. Similarly, if the total available memory is between 2 and 4 GB, the AvailPhys member of the Kernel.MEMORYSTATUS structure will be rounded down to 2 GB. If the executable is linked using the /LARGEADDRESSWARE linker option, then the GlobalMemoryStatus function will return the correct amount of physical memory in both members.
Kernel Class | Tao.Platform.Windows Namespace | Kernel.MEMORYSTATUS