RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System::THeapStatus Record

System::THeapStatus represents information about the global heap.

Pascal
THeapStatus = record
  TotalAddrSpace: Cardinal;
  TotalUncommitted: Cardinal;
  TotalCommitted: Cardinal;
  TotalAllocated: Cardinal;
  TotalFree: Cardinal;
  FreeSmall: Cardinal;
  FreeBig: Cardinal;
  Unused: Cardinal;
  Overhead: Cardinal;
  HeapErrorCode: Cardinal;
end;
C++
struct THeapStatus {
  Cardinal TotalAddrSpace;
  Cardinal TotalUncommitted;
  Cardinal TotalCommitted;
  Cardinal TotalAllocated;
  Cardinal TotalFree;
  Cardinal FreeSmall;
  Cardinal FreeBig;
  Cardinal Unused;
  Cardinal Overhead;
  Cardinal HeapErrorCode;
};

System::THeapStatus represents information about the current memory manager. These are the meanings of the values in each field:

Field 
Meaning 
TotalAddrSpace  
The (current) total address space available to your program, in bytes. This will grow as your program's dynamic memory usage grows.  
TotalUncommitted  
The total number of bytes (of TotalAddrSpace) for which space has not been allocated in the swap file.  
TotalCommitted  
The total number of bytes (of TotalAddrSpace) for which space has been allocated in the swap file. Note : TotalUncommitted + TotalCommitted = TotalAddrSpace  
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. (The exact size of the blocks is immaterial).  
Unused  
Total bytes which have never been allocated by your program. Note : Unused + FreeBig + FreeSmall = TotalFree These three fields (Unused, FreeBig, and FreeSmall) refer to dynamic allocation by the user 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.  

Note: TotalAddrSpace, TotalUncommitted and TotalCommitted refer to OS memory used by the program, whereas TotalAllocated and TotalFree refer to the heap memory used within the program by dynamic allocations. Therefore, to monitor dynamic memory used in your program use TotalAllocated and TotalFree.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!