Solved

TLists -- Freeing Objects

Posted on 1997-04-19
3
164 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
calling procedure inside activexForm from secondform 1 232
How to use Hashing sha1 in Delphi 2010 4 206
tidtcpserver connection lost handle 2 72
SUM 2 INTEGER ARRAYS INTO 1 10 93
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now