From 0645c724d1bac953857d16120ee4d1c217714d96 Mon Sep 17 00:00:00 2001 From: Jan Rysavy Date: Tue, 21 Jul 2026 11:35:47 +0200 Subject: [PATCH] Use FillChar for larger debug block fills --- FastMM5.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/FastMM5.pas b/FastMM5.pas index 4d6aa4f..5dd05d3 100644 --- a/FastMM5.pas +++ b/FastMM5.pas @@ -4243,6 +4243,14 @@ procedure FillFreedDebugBlockWithDebugPattern(APDebugBlockHeader: PFastMM_DebugB LByteOffset := APDebugBlockHeader.UserSize; LPUserArea := PByte(APDebugBlockHeader) + CDebugBlockHeaderSize; + {Use FillChar above the measured crossover and retain the scalar path for smaller blocks.} + if LByteOffset >= 40 then + begin + FillChar(LPUserArea^, LByteOffset, CDebugFillByteFreedBlock); + PPointerArray(LPUserArea)[0] := TFastMM_FreedObject; + Exit; + end; + {Store a pointer to the freed object class if the block is large enough.} if LByteOffset >= CTObjectInstanceSize then begin @@ -4290,6 +4298,13 @@ procedure FillAllocatedDebugBlockWithDebugPattern(APDebugBlockHeader: PFastMM_De LByteOffset := APDebugBlockHeader.UserSize; LPUserArea := PByte(APDebugBlockHeader) + CDebugBlockHeaderSize; + {Use FillChar above the measured crossover and retain the scalar path for smaller blocks.} + if LByteOffset >= 40 then + begin + FillChar(LPUserArea^, LByteOffset, CDebugFillByteAllocatedBlock); + Exit; + end; + if LByteOffset and 1 <> 0 then begin Dec(LByteOffset);