delphi - 如何使用 fastMM 追踪棘手的内存泄漏?

标签 delphi memory-leaks delphi-2009 fastmm

将项目从 Delphi 2007 升级到 Delphi 2009 后,我遇到了未知的内存泄漏,到目前为止我一直在尝试使用 fastMM 来跟踪它,以下是 fastMM 堆栈跟踪报告的内容:

A memory block has been leaked. The size is: 20

This block was allocated by thread 0x111C, and the stack trace (return addresses) 
  at the time was:
40339E [System.pas][System][@GetMem][3412] 534873 [crtl][_malloc]
56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918]
56D316 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3961]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
562D48 [DBCommon.pas][DBCommon][TFilterExpr.PutExprNode][1583]
408E46 [System.pas][System][DynArraySetLength][20464]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
408E92 [System.pas][System][@DynArraySetLength][20486]
528C1B [Forms.pas][Forms][TCustomForm.DoCreate][3260]
171A1A [GetRawStackTrace]

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

The allocation number is: 302844

有时我会得到这个:

A memory block has been leaked. The size is: 20

This block was allocated by thread 0x111C, and the stack trace (return addresses) 
  at the time was:
40339E [System.pas][System][@GetMem][3412]
534873 [crtl][_malloc]
56D1C4 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3918]
56D316 [canex.cpp][MidasLib][DllGetDataSnapClassObject][3961]
77DC921A [RtlAnsiStringToUnicodeString]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
7726B8F5 [GetProcAddress]
7726B907 [GetProcAddress]
589B1E [ossrv.cpp][MidasLib][DllGetDataSnapClassObject][3163]
56D5EE [canex.cpp][MidasLib][DllGetDataSnapClassObject][4085]
408E92 [System.pas][System][@DynArraySetLength][20486]

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

是否有更好的方法来找出真正导致内存泄漏的原因?

最佳答案

此内存泄漏是由 Delphi bug 引起的,QC #67709

它已被最新的 Delphi 2009 更新修复,难怪我无法修复它。

关于delphi - 如何使用 fastMM 追踪棘手的内存泄漏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/271850/

相关文章:

c# - 应用程序退出后仍保留在内存中

ruby-on-rails - Rails csv导入内存消耗问题postgres

delphi - 奇怪的 WM_CHAR 行为(错误的 chCharCode)

delphi - 调试 Delphi Firemonkey Indy TCP 服务器

web-services - 使用 Web 服务时出现此错误的原因是什么?

delphi - 函数的返回值可能未定义

delphi - 德尔福中的 Char 和 Chr

android - 回收位图不释放内存

delphi - 如何从 FastMM 获取堆栈跟踪

delphi - 如何在 PostBuild 事件上并行执行程序?