Platform SDK: Memory

MEMORYSTATUS

The MEMORYSTATUS structure contains information about the current state of both physical and virtual memory. The GlobalMemoryStatus function stores information in a MEMORYSTATUS structure.

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; 
} MEMORYSTATUS, *LPMEMORYSTATUS; 

Members

dwLength
Size, in bytes, of the MEMORYSTATUS data structure. You do not need to set this member before calling the GlobalMemoryStatus function; the function sets it.
dwMemoryLoad
Windows NT 3.1 NT 4.0: The percentage of approximately the last 1000 pages of physical memory that is in use.

Windows 2000: The approximate percentage of total physical memory that is in use.

dwTotalPhys
Total size, in bytes, of physical memory.
dwAvailPhys
Size, in bytes, of physical memory available.
dwTotalPageFile
Total possible size, in bytes, of the paging file. Note that this number does not represent the actual physical size of the paging file on disk.
dwAvailPageFile
Size, in bytes, of space available in the paging file. The operating system can enlarge the paging file from time to time. The dwAvailPageFile member shows the difference between the size of current committed memory and the current size of the paging file — it does not show the largest possible size of the paging file.
dwTotalVirtual
Total size, in bytes, of the user mode portion of the virtual address space of the calling process.
dwAvailVirtual
Size, in bytes, of unreserved and uncommitted memory in the user mode portion of the virtual address space of the calling process.

Remarks

MEMORYSTATUS reflects the state of memory at the time of the call. It reflects the size of the paging file at that time. The operating system can enlarge the paging file up to the maximum size set by the administrator.

On computers with more than 4 GB of memory, the MEMORYSTATUS structure can return incorrect information. Windows 2000 reports 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. If your application is at risk for this behavior, use the GlobalMemoryStatusEx function instead of the GlobalMemoryStatus function.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winbase.h; include Windows.h.

See Also

Memory Management Overview, Memory Management Structures, GlobalMemoryStatus, GlobalMemoryStatusEx