Solved

Boundschecker detects resource leak in Tlist

Posted on 1998-03-02
7
221 Views
Last Modified: 2011-09-20
I'm using Boundchecker 5.03 to debug applications that were created in Delphi 3.02. I've noticed that Boundschecker reports resource leaks every time my code creates a TList or TStringList object.

I either call TList.Create in the constructor for an object and call the Free method in the corresponding destructor, or I encapsulate the 'Create' and 'Free' methods in a try..finally block.  I can't see where I'm going wrong and create /destroy plenty of other objects dynamically without any resource leaks.  The size of each resource leak varies which I also think is odd.

Can anyone help?
0
Comment
Question by:andrewjackson
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 1

Expert Comment

by:bcrotaz
Comment Utility
When you free the list, is it empty?
If you delete an object or free the list, you don't free the listed objects.  You'll need to iterate through the list and free them first.
0
 

Author Comment

by:andrewjackson
Comment Utility
Thanks for you reply but I do free all the listed objects.  Anyhow, even if I didn't this would show as resource leaks where I created the listed objects, and be in no way associated with any particular TList object. In the case of a TStringList, I've assumed that Delphi handles deletion of all listed strings even though resource leaks are still reported.  
0
 
LVL 1

Expert Comment

by:bcrotaz
Comment Utility
Yes....it does free the strings.
I've no idea in that case.
I'll step back for someone else.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
Can you show some code?
0
 
LVL 3

Accepted Solution

by:
williams2 earned 100 total points
Comment Utility
I think you should try and check boths objects Capacity properties. Delphi normally controls their capacity automatically, but you should be able to set them manually.
If you delete Items, The Items might still exist in memory, but you can remove them by setting

List.Capacity:=List.Count;

..Maybe it works? I haven't got a Boundschecker :-)
0
 

Author Comment

by:andrewjackson
Comment Utility
I've spotted a similar question to mine posted on the

borland.public.delphi.objectpascal

newsgroup.  The problem has been traced to a bug in Boundschecker and acknowledged by Numega so the reported resource leaks do not actually exist.  Thanks all the same for all the suggestions that have been posted.
0
 
LVL 3

Expert Comment

by:williams2
Comment Utility
Now you have found the bug, I've been working on an alternative TList component build with a relative doublechained listindex. It works similar, but is a bit faster in some ways.
Now you have graded me, you can have it if you like..
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
APK file name 7 63
System restore point 4 77
Print Graphic and Text to Epson TM-T88v 12 109
Adoquery sql  left join does not work 25 43
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

14 Experts available now in Live!

Get 1:1 Help Now