当我从IDE运行该应用时,我的应用在退出时报告此错误。对于程序运行时创建的线程的每个实例,我通常都会得到一个FastMM缺陷,但是这种重复性不足以表征这种行为。问题是我对报告毫无意义。

---------------------------
APP.exe: Memory Error Detected
---------------------------
FastMM has detected an error during a free block scan operation. FastMM detected that a block has been modified after being freed.

The previous block size was: 40

Stack trace of when this block was previously allocated (return addresses):
403052 [APPHardwareDeclarations.pas][System][System.@GetMem][645]
405F0D [UFlxNumberFormat.pas][System][System.@NewAnsiString][956]
4065E1 [APPGlobalDeclarations.pas][System][System.@LStrSetLength][3356]
411AF7 [madStrings][madStrings.WideToAnsiEx]
41ACE8 [madTools][madTools.FindModule]
720074 [RpRenderCanvas][RpRenderCanvas.TRvRenderCanvas.FloodFill]
720074 [RpRenderCanvas][RpRenderCanvas.TRvRenderCanvas.FloodFill]
780065 [UXlsReferences][UXlsReferences.TReferences.SaveToStream]
4AAB2E [ExtCtrls][ExtCtrls.TTimer.Timer]

Stack trace of when the block was previously freed (return addresses):
405E59 [APPSendEmailSMTPQueue.pas][System][System.@LStrClr][494]
406DD3 [APPGlobalDeclarations.pas][System][System.@FinalizeArray][3584]
406D5D [APPGlobalDeclarations.pas][System][System.@FinalizeRecord][3560]
406E38 [APPGlobalDeclarations.pas][System][System.@FinalizeArray][3602]
47B6F2 [Classes][Classes.TStringList.Destroy]
404DFF [GIFImage.pas][System][System.TObject.Free][12891]
468741 [SysUtils][SysUtils.FreeAndNil]
506600 [StringUtilities][StringUtilities.AddCommaTextPair]
85C738 [APPLogWebTransactionsQueue][APPLogWebTransactionsQueue.ServiceWebTransactionQueue]

The current stack trace leading to this error (return addresses):
40D04C [FastMM4][FastMM4.CheckBlocksOnShutdown]
40DE88 [FastMM4][FastMM4.Finalization]
4059F3 [GraphicEx.pas][System][System.FinalizeUnits][8123]
458CAA [madExcept][madExcept.InterceptFinalizeUnits]
405CCB [IdCoderXXE.pas][System][System.@Halt0][85]
924868
7C90DCBA [ZwSetInformationThread]
7C81776F [RegisterWaitForInputIdle]
7C817778 [RegisterWaitForInputIdle]

Current memory dump of 256 bytes starting at pointer address 16902788:
6C 6A 95 00 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 D7 D8 6F E9 80 80 80 80 80 80 00 00 41 1E 90 16 00 00 00 00 00 00 00 00
00 00 00 00 52 30 40 00 9B 4D 40 00 11 82 40 00 62 51 40 00 E2 5B 64 00 21 76 64 00 68 77 64 00
12 B0 64 00 AD D6 64 00 6E 30 40 00 B9 4D 40 00 AD 51 40 00 6A 5C 64 00 78 82 40 00 78 35 64 00
83 81 40 00 48 6E 40 00 5D 6D 40 00 28 00 00 00 04 44 64 00 C0 27 90 16 6C 6A 95 00 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
3F D8 6F E9 80 80 80 80 00 00 00 00 40 FF 8F 16 00 00 00 00 00 00 00 00 00 00 00 00 52 30 40 00
0D 5F 40 00 E1 65 40 00 F7 1A 41 00 E8 AC 41 00 74 00 72 00 74 00 72 00 65 00 78 00 2E AB 4A 00
l  j  •  .  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €
€  €  €  €  €  €  €  €  ×  Ø  o  é  €  €  €  €  €  €  .  .  A  .    .  .  .  .  .  .  .  .  .
.  .  .  .  R  0  @  .  ›  M  @  .  .  ‚  @  .  b  Q  @  .  â  [  d  .  !  v  d  .  h  w  d  .
.  °  d  .  ­  Ö  d  .  n  0  @  .  ¹  M  @  .  ­  Q  @  .  j  \  d  .  x  ‚  @  .  x  5  d  .
ƒ    @  .  H  n  @  .  ]  m  @  .  (  .  .  .  .  D  d  .  À  '    .  l  j  •  .  €  €  €  €
€  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €
?  Ø  o  é  €  €  €  €  .  .  .  .  @  ÿ    .  .  .  .  .  .  .  .  .  .  .  .  .  R  0  @  .
.  _  @  .  á  e  @  .  ÷  .  A  .  è  ¬  A  .  t  .  r  .  t  .  r  .  e  .  x  .  .  «  J  .


记录该项目先前被释放的时间。

468741 [SysUtils][SysUtils.FreeAndNil]
506600 [StringUtilities][StringUtilities.AddCommaTextPair]
85C738 [APPLogWebTransactionsQueue][APPLogWebTransactionsQueue.ServiceWebTransactionQueue]


都是明智的,但下一行:
404DFF [GIFImage.pas] [系统] [System.TObject.Free] [12891]
让我感到困惑。我希望此时会调用Free,但是GIFImage.pas在这里做什么?先前分配该块的时间的跟踪是完全随机的。这些项目都没有道理。
我感觉到FastMM设置不正确,或者FastMM正在从内存浪费中获取堆栈跟踪。

在使用Delphi 2006进行编译后,我最初遇到了这个问题。全新安装的Delphi 2007具有相同的行为。谁能告诉我怎么回事?
TIA
[R

最佳答案

可能会有一些堆栈跟踪错误(例如不正确的单元名称或某些完全不正确的行,您应该在整个堆栈跟踪上看起来更一般,并跳过不正确的个别行)

我想您并不完全了解此错误。
快速MM仅检测到某些释放的内存块已被修改(正在应用程序退出时检测到此情况,但在块修改时未检测到)

在这种情况下,堆栈跟踪仅显示块分配和释放的时间,而不显示修改时间。
寻找此类错误非常困难,您将必须查找内存损坏的位置,可以使用FastMM内置过程检查内存完整性(在大多数可疑的内存操作之后将其调用到各处)并祝您好运。

07-25 23:45