Returns information about the physical memory managed by a process.
BOOLEAN GetRtSystemMemoryInfo( DWORD dwMemtype, LPVOID pMemoryInfo );
dwMemtype
pMemoryInfo
The following values of dwMemtype are defined and are shown with their companion structure definition.
dwMemType |
Structure used | Description |
---|---|---|
GET_SYSTEM_MEMORY_AREA_LIST |
typedef struct tagSystemMemoryInfo { DWORD count; struct physical_memory_area_desc { QWORD area_base; QWORD area_size; DWORD area_flags; } area[1]; } SYSTEM_MEMORY_INFO; |
Returns a list of memory areas assigned to the current node. Set the value of the count field to the number of elements available in the array area[]. On return the count field is updated and the elements of the array are filled in with the pool information. Use this call to locate unmanaged memory areas to be managed by your application directly. The
|
All other values of dwMemtype
are reserved for future use.
TRUE
FALSE
The following sample illustrates how to use the call with the GET_SYSTEM_MEMORY_AREA_LIST
information type.
GetRtSystemMemoryInfo sample |
Copy Code |
---|---|
#include <stdio.h> #include <rt.h> int main(int argc, char* argv[]) { SYSTEM_MEMORY_INFO smi, *smip; DWORD i, n; // Start with a buffer for a single area // Initialize the count to 1 smi.count = 1; if (GetRtSystemMemoryInfo(GET_SYSTEM_MEMORY_AREA_LIST, &smi)) { // the call returns the number of areas available n = smi.count; if (n > 1) { // now get the data for all of the areas smip = malloc(4+(sizeof(smi.area)*n)); smip->count = n; if (!GetRtSystemMemoryInfo(GET_SYSTEM_MEMORY_AREA_LIST, smip)) { printf("Failed to GetRtSystemMemoryInfo: %04x\n", GetLastRtError()); return 1; } } else { smip = &smi; } for (i = 0; i < smip->count; i++) { printf("Pool %u: base %05x_%08x size %llu MB flags=%u\n", i, (DWORD)(smip->area[i].area_base>>32), (DWORD)(smip->area[i].area_base), smip->area[i].area_size/0x100000, smip->area[i].area_flags); } } else { printf("Could not GetRtSystemMemoryInfo: %04x\n", GetLastRtError()); } return 0; } |
E_PARAM
E_BAD_ADDR
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 6.2 | intime/rt/include/rtbase.h | rt.h | rt.lib |