Code: Select all
procedure TZTestSysUtilsCase.TestDebug;
var
temp:Pointer;
begin
CheckEquals(True, debug_get_memorydiff>0);
CheckEquals(0, debug_get_memorydiff);
GetMem(Temp,5);
FreeMem(Temp,5);
CheckEquals(0, debug_get_memorydiff);
GetMem(Temp,4);
{$IFDEF DELPHI12_UP}
{ Seems like GetMem allocates using blocks of 8 bytes + 4 bytes extra at start}
CheckEquals(12, debug_get_memorydiff);
{$ELSE}
{ Seems like GetMem allocates using blocks of 8 bytes}
CheckEquals(8, debug_get_memorydiff);
{$ENDIF}
FreeMem(Temp,4);
{$IFDEF DELPHI12_UP}
CheckEquals(-12, debug_get_memorydiff);
{$ELSE}
CheckEquals(-8, debug_get_memorydiff);
{$ENDIF}
end;