Solved

TLists -- Freeing Objects

Posted on 1997-04-19
3
168 Views
Last Modified: 2010-04-04
I have memory leaks in my TList code.  Will a TList free the objects I add to it or do I have to free each individual object??  Sample code would be nice.
0
Comment
Question by:stimpy031597
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
mheacock earned 130 total points
ID: 1335509
You have to free each individual object.  See sample code in comment below.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1335510
for I := 0 to List1.Count - 1
    Free(List1.Items[I]);
List1.Free;

You'll have to free each object according to how you instantiated it...either using the Free function or a Free method or whatever.
0
 

Author Comment

by:stimpy031597
ID: 1335511
Thanks, I can figure the rest out myself.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
code issue 8 133
Printing problem 2 96
Delphi: barcode reading on android platform 1 30
Delphi: sending SMS on android platform 1 21
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question