Retrieves information about the system's current usage of both physical and virtual memory.
BOOL GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer );
A pointer to a MEMORYSTATUSEX structure that receives information about current memory availability.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
You can use the GlobalMemoryStatusEx function to determine how much memory your application can allocate without severely impacting other applications.
The information returned by the GlobalMemoryStatusEx function is volatile. There is no guarantee that two sequential calls to this function will return the same information.
The ullAvailPhys member of the MEMORYSTATUSEX structure at lpBuffer includes memory for all NUMA nodes.
The following code shows a simple use of the GlobalMemoryStatusEx function.
// Sample output: // There is 51 percent of memory in use. // There are 2029968 total KB of physical memory. // There are 987388 free KB of physical memory. // There are 3884620 total KB of paging file. // There are 2799776 free KB of paging file. // There are 2097024 total KB of virtual memory. // There are 2084876 free KB of virtual memory. // There are 0 free KB of extended memory.
|Minimum supported client||Windows XP [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2003 [desktop apps | UWP apps]|
|Header||sysinfoapi.h (include Windows.h)|