THeapStatus
THeapStatus is a record structure that is filled by Windows when you call
GetHeapStatus.
THeapStatus contains the following fields:
TotalAddrSpace | The (current) total address space available to your pascal program, in bytes. This will grow as your program's dynamic memory usage grows. |
TotalUncommited | The total number of bytes (of TotalAddrSpace) for which space has not been allocated in the swap file. |
TotalCommited | The total number of bytes (of TotalAddrSpace for which space has been allocated in the swap file. |
TotalAllocated | The total number of bytes dynamically allocated by your program. |
TotalFree | The total number of free bytes available in the (current) address space for allocation by your program. If this number is exceeded, and enough virtual memory is available, more address space will be allocated from the OS; TotalAddrSpace will be incremented accordingly. |
FreeSmall | Total bytes of small memory blocks which are not currently allocated by your program. |
FreeBig | Total bytes of big memory blocks which are not currently allocated by your program. Large free blocks can be created by coalescing smaller, contiguous, free blocks or by freeing a large dynamic allocation. |
Unused | Total bytes which have never been allocated by your program. |
Overhead | The total number of bytes required by the heap manager to manage all the blocks dynamically allocated by your program. |
HeapErrorCode | Indicates the current status of the heap, as internally determined. |
Here is an example of using
GetHeapStatus to determine the
TotalAddrSpace:
procedure TForm1.Button1Click(Sender: TObject);
var
hStatus : THeapStatus;
begin
hStatus := GetHeapStatus;
ShowMessage('Total Address ' + 'Space =' + IntToStr(hStatus.TotalAddrSpace));
end;