Solved

TLists -- Freeing Objects

Posted on 1997-04-19
3
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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