Page 1 of 1

[bug_fixed] TZTestSysUtilsCase.TestDebug

Posted: 03.12.2008, 12:17
by mariuszekpl
Seems like GetMem allocates using blocks of 8 bytes + 4 bytes extra at start

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;

Posted: 10.12.2008, 14:19
by mdaems
removed debug_get_memorydiff completely... Wasn't very uniform among different compilers.