Virtual Memory Status
A Windows function called GlobalMemoryStatus
retrieves dynamic information about the current state of memory:
VOID GlobalMemoryStatus(LPMEMORYSTATUS pmst);
I think that this function is poorly named–GlobalMemoryStatus
implies that the function is somehow related to the global heaps in 16-bit Windows. I think that GlobalMemoryStatus
should have been called something like VirtualMemoryStatus
instead.
When you call GlobalMemoryStatus
, you must pass the address of a MEMORYSTATUS
structure. The MEMORYSTATUS
data structure is shown here:
typedef struct _MEMORYSTATUS { DWORD dwLength; DWORD dwMemoryLoad; SIZE_T dwTotalPhys; SIZE_T dwAvailPhys; SIZE_T dwTotalPageFile; SIZE_T dwAvailPageFile; SIZE_T dwTotalVirtual; SIZE_T dwAvailVirtual; ...
Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.