FastMM4 how to read a log file?

I am working on software, so I just started using FastMM4 (for real) in my project.

I found on the net how to get line number

in FastMM4, I got the line number, but can I figure out what the other information in the log means?

I have this in a log file

This block was allocated by thread 0x15F8, and the stack trace (return addresses) at     the time was:
402E86 [system.pas][System][System.@GetMem][2648]
403A3B [system.pas][System][System.TObject.NewInstance][8824]
403DAA [system.pas][System][System.@ClassCreate][9489]
403A70 [system.pas][System][System.TObject.Create][8839]
46A257 [u_home.pas][u_home][u_home.TForm1.SpeedButton1Click][80] {<-memory leak is here, but what are the Other detections?}
443AAC [Controls.pas][Controls][Controls.TControl.Click][5226]
46958B [Buttons.pas][Buttons][Buttons.TSpeedButton.Click][1211]
46956B [Buttons.pas][Buttons][Buttons.TSpeedButton.MouseUp][1204]
443FB2 [Controls.pas][Controls][Controls.TControl.DoMouseUp][5352]
441BA0 [Controls.pas][Controls][Controls.TControl.SetMouseCapture][4379]
444042 [Controls.pas][Controls][Controls.TControl.WMLButtonUp][5364]

The block is currently used for an object of class: TStringList

The allocation number is: 440

      

it leak

has

   46A257 [u_home.pas][u_home][u_home.TForm1.SpeedButton1Click][80] {<-memory leak is here, but what are the Other detections?}

      

my code

 procedure TForm1.SpeedButton1Click(Sender: TObject);
  var
  str : TStringList;
  begin
  str := TStringList.Create;  {<--im not freeing the, so leak}

  end;

      

enter image description here

and so call stack

enter image description here

I've searched the net but I don't know what these other detections are ...

402E86 [system.pas][System][System.@GetMem][2648]
403A3B [system.pas][System][System.TObject.NewInstance][8824]
403DAA [system.pas][System][System.@ClassCreate][9489]
403A70 [system.pas][System][System.TObject.Create][8839]

{Other then this}
46A257 [u_home.pas][u_home][u_home.TForm1.SpeedButton1Click][80] {<-memory leak is here, but what are the Other detections?}
{Other then this}

443AAC [Controls.pas][Controls][Controls.TControl.Click][5226]
46958B [Buttons.pas][Buttons][Buttons.TSpeedButton.Click][1211]
46956B [Buttons.pas][Buttons][Buttons.TSpeedButton.MouseUp][1204]
443FB2 [Controls.pas][Controls][Controls.TControl.DoMouseUp][5352]
441BA0 [Controls.pas][Controls][Controls.TControl.SetMouseCapture][4379]
444042 [Controls.pas][Controls][Controls.TControl.WMLButtonUp][5364]

      

im using delphi 2006

I discovered and tried the same in delphi 6, delph 7

also

checked I found this related to fastMM $ detectg and logging some leaks that are already in delphi. How to track complex memory leak with fastMM? and this is for logging the leak, but are they errors? Using FastMM4, how to register a missing line?

Also FastMM4, Delphi6, Leak of TApplication?

OR are they just the steps leading to the memory leak?

+3


source to share


2 answers


That you have a call stack in the log that leaked memory.

You can see how useful it is on the call stack in your question. Imagine you only had the top line caused by a leak



402E86 [system.pas][System][System.@GetMem][2648]

      

This information by itself is practically useless as all heap allocations go through GetMem

. This call stack points to the events that led to the call GetMem

. And that is what points to what caused the leak.

+5


source


FastMM has no way of guessing the intent of the code and determining which instruction causing the memory allocation must have a matching instruction to release it.

Be aware that FastMM keeps a record of the entire memory allocation while your code is running.
It doesn't know why, how or where the leak occurs, just so that you don't release that particular allocation at the time your application exits and everything should be clean.



So when a leak is reported, it is indeed the distribution that is displayed.
FastMM doesn't know your application and can only display the whole call chain that leads to that particular point in the code where you allocate memory (usually one of the GetMem gazillion calls).
Meaningful information can be found by going up the stairs until you find a higher level instruction that needed some memory, for example, TButton.Create

and see if that particular button was freed or not (leaking all of its contents) or how TMyBadButton.Create

that creates some AltBitmap but never frees it.
In one case, the leak in the application code crepes the button without releasing it, in the other case it is in the component code TMyBadButton

.

Update : You may find useful this old CodeRage session Memory Leaks for Dummies

+4


source







All Articles