FastMM4,如何读取日志文件?

Pre*_*ias 3 delphi logging memory-leaks delphi-2006 fastmm

我正在研究一个软件,所以我刚开始在我的项目中使用FastMM4(真实的).

我在网上找到了关于如何获取line numberFastMM4,我得到了行号,但我可以弄清楚日志中的其他信息是什么意思?

我在日志文件中有这个

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
Run Code Online (Sandbox Code Playgroud)

在这leak

   46A257 [u_home.pas][u_home][u_home.TForm1.SpeedButton1Click][80] {<-memory leak is here, but what are the Other detections?}
Run Code Online (Sandbox Code Playgroud)

我的代码

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

  end;
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

这是 call stack 在此输入图像描述

我在网上搜索但我不知道其他的检测是什么...

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]
Run Code Online (Sandbox Code Playgroud)

我正在使用 delphi 2006

我已经打开并尝试了同样的delphi 6, delph 7事情

检查 我发现这与fastMM $ detectiong和已经在delphi中的一些泄漏的注册有关. 如何使用fastMM追踪棘手的内存泄漏? 这是为了注册泄漏,但他们是错误吗? 使用FastMM4,如何注册泄漏的字符串?

还有FastMM4,Delphi6,TApplication泄漏?

要么 are they just the steps leading to the memory leak?

Dav*_*nan 5

你在日志中有什么调用堆栈导致内存分配泄露.

您可以在问题中看到它在调用堆栈中的用处.想象一下,你只有顶线,导致泄漏的电话

402E86 [system.pas][System][System.@GetMem][2648]
Run Code Online (Sandbox Code Playgroud)

由于所有堆分配都通过,因此该信息本身几乎无用GetMem.它是调用堆栈,指向导致调用的事件GetMem.这就是确定导致泄漏的原因.


Fra*_*ois 5

FastMM 无法猜测代码背后的意图,也无法查明哪条指令导致内存分配应该有相应的指令来释放它。

请记住,FastMM 仅保留代码执行期间完成的所有内存分配的记录。
它不知道泄漏发生的原因、方式或地点,只是当您的应用程序关闭且一切都应该干净时您尚未释放此特定分配。

因此,当报告泄漏时,显示的实际上是一次分配。
FastMM 不了解您的应用程序,只能显示导致您分配内存的代码中特定点的整个调用链(通常是无数个 GetMem 调用之一)。
可以通过向上爬梯找到有意义的信息,直到找到需要一些内存的更高级别的指令,例如 aTButton.Create并查看该特定按钮是否被释放(泄漏其所有内容),或者像 a 一样TMyBadButton.Create创建一些 AltBitmap 但永远不会释放它。
在一种情况下,泄漏发生在应用程序代码中创建一个按钮而不释放它,在另一种情况下,泄漏发生在TMyBadButton组件代码中。

更新:您可能会发现这个旧的 CodeRage 会话Memory Leaks for Dummies很有用