Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Misc > Re: Dynamic arr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 13 Topic 6010 of 6157
Post > Topic >>

Re: Dynamic arrays of record/object

by Hans-Peter Diettrich <DrDiettrich1@[EMAIL PROTECTED] > Mar 13, 2008 at 05:15 PM

sakkieLFS@[EMAIL PROTECTED]
 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.

> If I declare this variable anywhere else besides local in the
> eventhandler, it fails????

The statement should read:
   Data := TXMLSectionData.Create;
regardless of where the Data variable resides.

DoDi
 




 13 Posts in Topic:
Dynamic arrays of record/object
sakkieLFS@[EMAIL PROTECTE  2008-03-12 11:46:46 
Re: Dynamic arrays of record/object
Rob Kennedy <me3@[EMAI  2008-03-12 18:31:17 
Re: Dynamic arrays of record/object
"Maarten Wiltink&quo  2008-03-13 10:28:13 
Re: Dynamic arrays of record/object
Hans-Peter Diettrich <  2008-03-12 23:08:41 
Re: Dynamic arrays of record/object
Rob Kennedy <me3@[EMAI  2008-03-13 01:07:21 
Re: Dynamic arrays of record/object
sakkieLFS@[EMAIL PROTECTE  2008-03-12 22:57:12 
Re: Dynamic arrays of record/object
Rob Kennedy <me3@[EMAI  2008-03-13 01:05:32 
Re: Dynamic arrays of record/object
sakkieLFS@[EMAIL PROTECTE  2008-03-12 23:09:38 
Re: Dynamic arrays of record/object
Hans-Peter Diettrich <  2008-03-13 17:15:23 
Re: Dynamic arrays of record/object
sakkieLFS@[EMAIL PROTECTE  2008-03-12 23:21:59 
Re: Dynamic arrays of record/object
sakkieLFS@[EMAIL PROTECTE  2008-03-12 23:56:26 
Re: Dynamic arrays of record/object
Jamie <jamie_ka1lpa_no  2008-03-13 19:04:01 
Re: Dynamic arrays of record/object
"alanglloyd@[EMAIL P  2008-03-13 02:32:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 11:16:28 CDT 2008.