AllocMemSize: Integer deprecated; {Unsupported}
New version:
Code: Select all
{$IFDEF DELPHI12_UP}
function ZeosAllocMemsize(): integer;
var
mManager: TMemoryManagerState;
Bytes: Integer;
I: Integer;
begin
Bytes :=0;
GetMemoryManagerState(mManager);
for I := 0 to High(mManager.SmallBlockTypeStates) do
begin
Inc(Bytes, mManager.SmallBlockTypeStates[I].AllocatedBlockCount
* mManager.SmallBlockTypeStates[I].UseableBlockSize);
end;
Inc(Bytes, mManager.TotalAllocatedMediumBlockSize);
Inc(Bytes, mManager.TotalAllocatedLargeBlockSize);
result := bytes;
end;
{$ENDIF}
function debug_get_memorydiff: Integer;
begin
{$IFDEF DELPHI12_UP}
result := ZeosAllocMemsize() - debug_last_used_memory;
debug_last_used_memory := ZeosAllocMemsize();
{$ELSE}
result := AllocMemsize - debug_last_used_memory;
debug_last_used_memory := AllocMemsize;
{$ENDIF}
end;