[fpc-pascal] FillChar/FillByte and Finalize()

Krzysztof dibo20 at wp.pl
Tue Mar 15 22:14:11 CET 2016


Hi,

Should I (and in which case) call Finalize() when using FillChar/FillByte?
Heaptrc unit is not detecting any memory leak. For example:

type
  PMyRec = ^TMyRec;
  TMyRec = record
    Field1: Int64;
    Field2: String;
    Field3: Int64;
    Field4: String;
    Field5: Boolean;
  end;

procedure push(ARec: PMyRec);
begin
  writeln(ARec^.Field2,',', ARec^.Field4);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  FillChar(f, SizeOf(TMyRec), 0);
  f.Field1 := 1;
  f.Field2 := 'abc';
  push(@f);
  FillChar(f, SizeOf(TMyRec), 0);
  f.Field1 := 2;
  f.Field2 := 'vbnj';
  push(@f);
end;

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160315/807b6131/attachment.html>


More information about the fpc-pascal mailing list