Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 581359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:34:13+00:00 2026-05-13T14:34:13+00:00

In the project I am working on, there are cases where more than one

  • 0

In the project I am working on, there are cases where more than one TList objects contain the same item object.

Essentially, there is a master list which contains all the item objects, then smaller lists that contain only a subset of all the items. The items are the same however, not a copy.

Where the problem arises is during destruction. The main list is freed, which frees all of the items. The main list takes care of freeing the items, by overriding “notify”, and the sub-lists override the “Notify” event so that the item is not freed a second time – which would fail anyway.

However, when using FastMM4, the memory leak log lists the items as leaking memory.

So how to go about freeing objects that belong to 2 or more lists?

By the way, this is not my code, I’m just doing some light maintenance on it. I’d like to avoid having to create a clone of each object to put in the separate lists if I can, but hey, a man’s gotta do what a man’s gotta do :o)

Thanks,

Bourgui

EDIT

Nevermind, I must be crazy. Now FastMM4 doesn’t flag the items as leaking… Only the sub-lists, which are actuallya sub-class of the main list.
There must be something I’m missing here. I’m going to run more tests to get a clearer picture of what is going on.

Thanks for all the replies so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:34:13+00:00Added an answer on May 13, 2026 at 2:34 pm

    Why do the sublists override the notify events? A TList does not free the items it contains. Or are you talking about TObjectLists?
    If TList, are you sure the items are actually freed? Is there any code that does it? If not, they are not freed and fastmm is right: They leak.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in a project where there are configuration files, one in number
I am working on one project where there is a functionality need to implement
I'm currently working on my first MVC project which is nothing more than a
A solver project I am working on (C#) requires to test if there is
In a project I'm working on, there is a table of units and then
In a Java EE 6 project I am working on, there is a lone
I'm working on a project where there is a lot of external service messaging.
I am working on a project currently where there are SQL strings in the
I'm working on a C++ project in which there are a lot of classes
I am working on a JAVA project in which there are multiple terminals. These

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.