The MemoryStatus class (MEMORYSTATUS.CLS) is simple, with just a few properties, all of them read-only. The properties, listed in Table 9.12, allow you to peek at the current memory situation in the computer that’s running your application.
Table 9.12: Properties for the MemoryStatus Class
Property | Description |
MemoryLoad | Number between 0–100 that gives a general idea of current memory utilization, in which 0 indicates no memory use and 100 indicates full memory use |
TotalPhysical | Indicates the total number of bytes of physical memory |
AvailablePhysical | Indicates the number of bytes of physical memory available |
TotalPageFile | Indicates the total number of bytes that can be stored in the paging file, not the size of the paging file on disk |
AvailablePageFile | Indicates the number of bytes available in the paging file |
TotalVirtual | Indicates the total number of bytes that can be described in the user mode portion of the virtual address space of the calling process |
AvailableVirtual | Indicates the number of bytes of unreserved and uncommitted memory in the user mode portion of the virtual address space of the calling process |
There are no properties in the MemoryStatus class dealing with available resources, as there might have been in a class written for a 16-bit operating system. The Win32 API does not contain any tools to retrieve information about available resources since this isn’t supposed to be an issue in 32-bit Windows. (Anyone who’s used Windows 95 extensively knows this isn’t the case, but under Windows NT, you certainly won’t be worrying about resource usage.)