FastMM突然报告Graphics32内存泄漏

发布于 2024-10-10 13:08:35 字数 431 浏览 2 评论 0原文

我有一个空项目(它只包含一个表单)。如果我将此行添加到项目“USES GR32_Image;”中并运行应用程序,FastMM 显示程序中存在泄漏。 FastMM 设置为完全调试。我的程序中没有任何代码 - 除了 Delphi IDE 生成的代码和“uses gr32”行之外。

这份报告毫无意义。 以下是完整日志:http://pastebin.com/Yhev3rJ2
这是源代码: http://pastebin.com/VjRrRiS8

我以前使用过 Graphics32 单元,我从来没有遇到过问题。为什么我会出现此泄漏以及为什么 FastMM 无法生成正确的报告?

I have an empty project (it contains just a form). If I add this line to the project 'USES GR32_Image;' and run the application, FastMM shows leak in the program. FastMM is set to full debug. There is NO code in my program - except what Delphi IDE generates and except the 'uses gr32' line.

The report makes no sense.
Here is the full log: http://pastebin.com/Yhev3rJ2
And here is the source code: http://pastebin.com/VjRrRiS8

I have used the Graphics32 unit before and I never had problems. Why I have this leak and why FastMM cannot generate a proper report?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

度的依靠╰つ 2024-10-17 13:08:35

如果您使用完整版本的 FastMM4,请启用 FullDebugMode。还可以打开详细的映射生成来帮助进行堆栈跟踪。检查该单元的单元初始化部分,看看是否存在任何问题。

Enable FullDebugMode if your using the full version of FastMM4. Also turn on detailed map generation to help with the stack trace. Check the unit initialization section of that unit and see if there are any issues.

许仙没带伞 2024-10-17 13:08:35

使用完整的调试信息编译您的应用程序,然后在链接器选项中,确保您的调试信息位于 .EXE 和/或 .MAP 文件中。

然后使用 FullDebugMode 运行 FastMM,并将生成的 .TXT 文件复制/粘贴到您的问题中。

另请参阅 这篇文章了解更多提示。

编辑

一个好的第一步是在您的 .TXT 文件上执行类似的操作:

find "The allocation number is" < fastmmlog.txt | sort /R

这将为您提供第一个分配编号,在您的情况下为 281

由此,您在 .TXT 中搜索分配号:

--------------------------------2011/1/7 23:31:03--------------------------------
A memory block has been leaked. The size is: 20

This block was allocated by thread 0x1540, and the stack trace (return addresses) at the time was:
402D80 [System][System][@GetMem]
40388F [System][System][TObject.NewInstance]
403C12 [System][System][@ClassCreate]
4038C4 [System][System][TObject.Create]
403C12 [System][System][@ClassCreate]
403C6A [System][System][@AfterConstruction]
457922 [GR32_Bindings][GR32_Bindings][NewRegistry]
45807E [GR32_LowLevel][GR32_LowLevel][RegisterBindings]
458152 [GR32_LowLevel][GR32_LowLevel][GR32_LowLevel]
404373 [System][System][InitUnits]
4043DB [System][System][@StartExe]

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

The allocation number is: 281

在这里您可以看到,NewRegistry 涉及您的泄漏。
从那里,您可以开始调试以找出泄漏的原因。

——杰罗恩

Compile your app with full debug info, then in the linker options, make sure your debug info is in the .EXE and/or .MAP file.

Then run FastMM with FullDebugMode, and copy/paste the resulting .TXT file in your question.

See also this post for more tips.

Edit:

A good first step is to do something like this on your .TXT file:

find "The allocation number is" < fastmmlog.txt | sort /R

That gives you the first allocation number, in your case 281.

From that, you search in the .TXT for the allocation number:

--------------------------------2011/1/7 23:31:03--------------------------------
A memory block has been leaked. The size is: 20

This block was allocated by thread 0x1540, and the stack trace (return addresses) at the time was:
402D80 [System][System][@GetMem]
40388F [System][System][TObject.NewInstance]
403C12 [System][System][@ClassCreate]
4038C4 [System][System][TObject.Create]
403C12 [System][System][@ClassCreate]
403C6A [System][System][@AfterConstruction]
457922 [GR32_Bindings][GR32_Bindings][NewRegistry]
45807E [GR32_LowLevel][GR32_LowLevel][RegisterBindings]
458152 [GR32_LowLevel][GR32_LowLevel][GR32_LowLevel]
404373 [System][System][InitUnits]
4043DB [System][System][@StartExe]

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

The allocation number is: 281

Here you can see, that the NewRegistry is involved in your leak.
From there, you can start debugging to find out why it leaks.

--jeroen

唱一曲作罢 2024-10-17 13:08:35

两个问题都解决了。

  1. 我记得前段时间我在GR32.inc中添加了这行代码:
    {$D-}
    我删除了该行,重新编译了 VCL,它工作了。完全是我的错。

  2. 参见 Jeroen Pluimers 的帖子,回答了“为什么 FastMM 无法生成正确的报告?”的问题


感谢大家的参与。

Both issues solved.

  1. I remembered that some time ago I added this line of code in GR32.inc:
    {$D-}
    I removed the line, recompiled the VCL and it worked. Totally my fault.

  2. See Jeroen Pluimers post which answer the question "why FastMM cannot generate a proper report?"


Thanks to all for participating.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文