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 4062350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:35:14+00:00 2026-05-20T15:35:14+00:00

We are trying to figure out if we have memory leaks in our software.

  • 0

We are trying to figure out if we have memory leaks in our software. So, I have been using various tools and programs to help me find possible memory leaks. One of the software I used was AQTime. As it came with Delphi XE, it was only a demo. So, I was not really able to get any useful information from it. Then, I decided to use free software, MemProof. So far, it has shown me many issues with our software that requires attention. One of which is an error.

As soon as I start my program through MemProof, it lists 2 errors, which is attempting to destroy non-existent object from the unit file, system.pas. So, when I actually put a break point within TObject.Free procedure, it breaks even before my program started all the way. Stepping through the procedure Free in system.pas, I found out that TIconimage is trying to destroy or free itself. In other word, free procedure is not invoked from within my program prior to actually starting up.

Here is the actual Free procedure:

procedure TObject.Free;
begin
  if Self <> nil then
    Destroy;
end;

After that observation, I removed the breakpoint and let the program run all the way. My programs main window popped up ready for user input. However, I also found out that TObject.Free procedure is invoked non-stop if any part of my program’s WINDOW is displayed on the screen. I don’t understand that at all. Why is that? Can anyone explain? How is TForm is related to TObject.Free in any shape or form as the procedure is constantly invoked when the TForm is displayed on the screen?

Thanks in advance.

  • 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-20T15:35:15+00:00Added an answer on May 20, 2026 at 3:35 pm

    Regarding why TObject.Free executes a lot, every single time an object is destroyed, any object, that method will be called. All classes derive from TObject, it’s the common ancestor, so almost any action in a Delphi program involves large numbers of object create/destroy pairs and consequently will hit TObject.Free.

    Regarding detection of memory leaks, you have all you need built in to Delphi to solve this. The FastMM memory manager can be run in “report memory leaks” mode and it will give you loads of diagnostics of any memory that you leak.

    Consider the following trivial program:

    program Leaker;
    begin
      ReportMemoryLeaksOnShutdown := True;
      TObject.Create;
    end.
    

    This results in the following output:

    enter image description here

    You just need to set ReportMemoryLeaksOnShutdown to True somewhere in your app (the start of the .dpr file is as good a place as any).

    If you wish to receive more information in the report then you can download the full version of FastMM and configure it to your heart’s content.

    Then you get output like this:

    A memory block has been leaked. The size is: 84
    
    This block was allocated by thread 0x1304, and the stack trace (return addresses) at the time was:
    40455E [System][System.@GetMem]
    405A2F [System][System.TObject.NewInstance]
    40602E [System][System.@ClassCreate]
    4474C2 [Classes][Classes.TStringList.Create]
    C275A3 [Main.pas][Main][Main.TMainForm.CreateAuxiliaryForms][997]
    C84C8A [OrcaFlex.dpr][OrcaFlex][OrcaFlex.OrcaFlex][351]
    75E633CA [BaseThreadInitThunk]
    77519ED2 [Unknown function at RtlInitializeExceptionChain]
    77519EA5 [Unknown function at RtlInitializeExceptionChain]
    
    The block is currently used for an object of class: TStringList
    

    It’s truly wonderful. It tells me that the leaking memory was allocated in Main.pas line 997, and that’s precisely where I put my intentional leak!

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

Sidebar

Related Questions

I have been trying to figure out a solution but nothing has really presented
I have been trying to figure out a way to tag several methods from
I have been trying to figure out why and how to use performSelector. I
I have been trying to figure out why it doesn't read my second getline()
I am trying to figure out the memory consumption by my (C++) program using
I'm trying to figure out how to have a short, one line conditional statement.
I'm trying to figure out how I can have a comment header automatically added
I am trying to figure out an easy way to have a password protected
I'm trying to figure out what version of Crystal Reports I have. It's the
I am trying to figure out how to create 3 divs and have them

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.