Possible error or defect
Opened this issue · 1 comments
sezuk commented
In the function FastMM_GetMem_GetLargeBlock
{Insert the block in the first available arena.}
while True do
begin
LPLargeBlockManager := @LargeBlockManagers[0];
for LArenaIndex := 0 to CFastMM_LargeBlockArenaCount - 1 do
begin
if (LPLargeBlockManager.LargeBlockManagerLocked = 0)
and (AtomicExchange(LPLargeBlockManager.LargeBlockManagerLocked, 1) = 0) then
begin
PLargeBlockHeader(Result).LargeBlockManager := LPLargeBlockManager;
{Insert the large block into the linked list of large blocks}
LOldFirstLargeBlock := LPLargeBlockManager.FirstLargeBlockHeader;
PLargeBlockHeader(Result).PreviousLargeBlockHeader := Pointer(LPLargeBlockManager);
LPLargeBlockManager.FirstLargeBlockHeader := Result;
PLargeBlockHeader(Result).NextLargeBlockHeader := LOldFirstLargeBlock;
LOldFirstLargeBlock.PreviousLargeBlockHeader := Result;
LPLargeBlockManager.LargeBlockManagerLocked := 0;
{Add the size of the header}
Inc(PByte(Result), CLargeBlockHeaderSize);
Exit;
end;
{Try the next arena.}
Inc(LPLargeBlockManager);
end;
end;
{All large block managers are locked: Back off and try again.}
LogLargeBlockThreadContentionAndYieldToOtherThread;
The call to LogLargeBlockThreadContentionAndYieldToOtherThread must be inside a loop, otherwise it will never reach it.
pleriche commented
Fixed. Thank you!