GetHeapStatus Function
GetHeapStatus
returns a record that contains the
status of Delphi’s memory manager. If a new memory manager has
been installed and the new one does not use Delphi’s built-in
memory manager, all the values in the heap status will be zero.
GetHeapStatus
is a real
function.
Call IsMemoryManagerSet
to learn whether a custom
memory manager has been installed. If so, the value returned by
GetHeapStatus
is not necessarily valid.
procedure TForm1.Button1Click(Sender: TObject);
procedure AddFmt(const Fmt: string; Args: array of const);
begin
Memo1.Lines.Add(Format(Fmt, Args));
end;
var
Status: THeapStatus;
begin
Status := GetHeapStatus;
AddFmt('TotalAddrSpace = %d', [Status.TotalAddrSpace]);
AddFmt('TotalUncommitted = %d', [Status.TotalUncommitted]);
AddFmt('TotalCommitted = %d', [Status.TotalCommitted]);
AddFmt('TotalAllocated = %d', [Status.TotalAllocated]);
AddFmt('TotalFree = %d', [Status.TotalFree]);
AddFmt('FreeSmall = %d', [Status.FreeSmall]);
AddFmt('FreeBig = %d', [Status.FreeBig]);
AddFmt('Unused = %d', [Status.Unused]);
AddFmt('Overhead = %d', [Status.Overhead]);
AddFmt('HeapErrorCode = %d', [Status.HeapErrorCode]);
end;
AllocMemCount Variable, AllocMemFree Variable, IsMemoryManagerSet Function, SetMemoryManager Procedure, THeapStatus Type |