[bug_fixed] debug_get_memorydiff

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
mariuszekpl
Senior Boarder
Senior Boarder
Posts: 54
Joined: 30.09.2008, 10:59

[bug_fixed] debug_get_memorydiff

Post by mariuszekpl »

AllocMemsize don't work in Delphi 2009
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;
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I removed the debug_get_memorydiff function again. It was just a utility to use while debugging memory issues. As it also didn't work for fpc, ...
Locked