[Lazarus] typinfo routine gives memory leak

Howard Page-Clark hdpc at talktalk.net
Tue Sep 20 22:59:41 CEST 2011


The following (button and memo) program loses 276 bytes heap memory that 
are not recovered.

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
   Forms, StdCtrls;

type
   TForm1 = class(TForm)
     BGetProperties: TButton;
     Memo1: TMemo;
     procedure BGetPropertiesClick(Sender: TObject);
   end;

var
   Form1: TForm1;

implementation

uses Dialogs, typinfo;

{$R *.lfm}

procedure TForm1.BGetPropertiesClick(Sender: TObject);
var ppl: PPropList;
     pl: TPropList;
     ppi: PPropInfo;
     pi: TPropInfo;
begin
   GetPropList(TEdit, ppl);
   pl := ppl^;
   ppi := pl[0];
   pi := ppi^;
   if PropIsType(TEdit, pi.Name, tkAString) then
   ShowMessageFmt('TEdit''s first PropList entry is %s of 
tkAString',[pi.Name]);
end;

end.

Anyone know what I'm doing wrong?

Howard




More information about the Lazarus mailing list