Tao.Platform.Windows SDK Documentation

Kernel.GlobalMemoryStatus Method 

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.

[Visual Basic]
Public Shared Sub GlobalMemoryStatus( _
   ByRef buffer As MEMORYSTATUS _
)
[C#]
public static void GlobalMemoryStatus(
   out MEMORYSTATUS buffer
);

Parameters

buffer
Pointer to a Kernel.MEMORYSTATUS structure. The GlobalMemoryStatus function stores information about current memory availability into this structure.

Remarks

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.

See Also

Kernel Class | Tao.Platform.Windows Namespace | Kernel.MEMORYSTATUS