Monitoring Memory Usage
Go Up to Managing Memory Index
This section describes how to monitor the state of the Memory Manager.
The Memory Manager provides two procedures that allow the application to monitor its own memory usage and the state of the process's address space. Both functions are thread safe.
To monitor memory usage for your application:
- Call the procedure GetMemoryManagerState.
- Inspect the populated TMemoryManagerState structure and extract the needed Memory Manager state information. The structure has fields detailing the total number of allocations, the sum of their sizes, as well as the total reserved address space. The statistics are subdivided into three categories: small, medium and large allocations.
To get a map of the memory address space for a process
- Call the procedure GetMemoryMap.
- Inspect the populated TMemoryMap array and extract the needed information regarding the process' address space. The array contains a TChunkStatus entry for every possible 64K block in the process' address space.