Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memory leak TObjectList.Add(TObject.Create())

Status
Not open for further replies.

sedivy

Programmer
Oct 22, 2001
1
AG
Hi,

I want to know if this statement:

TObjectList.Add(TObject.Create())

would cause a memory leak and if so why ? (considering that TObject and TObjectList represent real classes derived from TObject and TObjectList)

If TObject.Create() fails, nothing is added to the objectlist right ?

Thanks
 
if TObject.Create() fails, then nothing is added as an exception will be raised.

Also, provided you have set the OwnsObjects property to true, the list will free the objects it contains when necessary.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top