Re: Dynamic arrays of record/object
- From: Rob Kennedy <me3@xxxxxxxxxxx>
- Date: Thu, 13 Mar 2008 01:07:21 -0500
Hans-Peter Diettrich wrote:
sakkieLFS@xxxxxxxxx wrote:procedure TForm1.Button1Click(Sender: TObject);
var Data: TXMLSectionData;
begin
Data.Create;
Data.AddSection('Header1','test data');
end;
The object in the local variable will be lost (memory leak) on exit from the method :-(
Move the "var Data..." line into the form class, the "Data.Create" into the form constructor, and add Data.Free to the form destructor.
Actually, you want to move the expression "Data.Create" into the bitbucket. <g>
--
Rob
.
- References:
- Dynamic arrays of record/object
- From: sakkieLFS
- Re: Dynamic arrays of record/object
- From: Hans-Peter Diettrich
- Dynamic arrays of record/object
- Prev by Date: Re: Dynamic arrays of record/object
- Next by Date: Re: Dynamic arrays of record/object
- Previous by thread: Re: Dynamic arrays of record/object
- Next by thread: Re: Dynamic arrays of record/object
- Index(es):