Browse Source

Allow shrinking small chunks.

Rika Ichinose 2 months ago
parent
commit
bc59422f00
1 changed files with 1 additions and 2 deletions
  1. 1 2
      rtl/inc/heap.inc

+ 1 - 2
rtl/inc/heap.inc

@@ -1698,8 +1698,7 @@ var
 begin
 begin
   h := HeapInc.pCommonHeader(p - HeapInc.CommonHeaderSize)^.h;
   h := HeapInc.pCommonHeader(p - HeapInc.CommonHeaderSize)^.h;
   if h and HeapInc.FixedFlag <> 0 then
   if h and HeapInc.FixedFlag <> 0 then
-    { Don’t shrink fixed chunk. }
-    result := size <= SizeUint(HeapInc.IndexToSize(h and HeapInc.SizeIndexMask) - HeapInc.CommonHeaderSize)
+    result := (size <= HeapInc.MaxFixedHeaderAndPayload - HeapInc.CommonHeaderSize) and (h and HeapInc.SizeIndexMask = HeapInc.SizeMinus1ToIndex(size + (HeapInc.CommonHeaderSize - 1)))
   else
   else
   begin
   begin
     ts := @HeapInc.thisTs;
     ts := @HeapInc.thisTs;