Browse Source

* merge with both the previous and next adjacent free blocks in the win16 global
heap manager, when freeing a block, adjacent to free space on both sizes

git-svn-id: trunk@37635 -

nickysn 7 years ago
parent
commit
87d5cc014f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      rtl/win16/glbheap.inc

+ 6 - 0
rtl/win16/glbheap.inc

@@ -227,6 +227,12 @@ circular linked list.
             if Ofs(PrevSubBlock^)+PrevSubBlock^.Size=Ofs(Addr^) then
               begin
                 Inc(PrevSubBlock^.Size,ASize);
+                { merge with next as well? }
+                if (Ofs(PrevSubBlock^)+PrevSubBlock^.Size)=Ofs(CurSubBlock^) then
+                  begin
+                    Inc(PrevSubBlock^.Size,CurSubBlock^.Size);
+                    PrevSubBlock^.Next:=CurSubBlock^.Next;
+                  end;
               end
             else
               begin