Solved

TLists -- Freeing Objects

Posted on 1997-04-19
3
162 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
Comment Utility
You have to free each individual object.  See sample code in comment below.
0
 
LVL 3

Expert Comment

by:mheacock
Comment Utility
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
Comment Utility
Thanks, I can figure the rest out myself.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

9 Experts available now in Live!

Get 1:1 Help Now