浏览代码

* fixed heap block start and size alignment in RegisterTinyHeapBlock

git-svn-id: trunk@24519 -
nickysn 12 年之前
父节点
当前提交
9312419ce8
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      rtl/inc/tinyheap.inc

+ 3 - 1
rtl/inc/tinyheap.inc

@@ -230,11 +230,13 @@
 {$ifdef DEBUG_TINY_HEAP}
 {$ifdef DEBUG_TINY_HEAP}
         Writeln('RegisterTinyHeapBlock(', ptruint(AAddress), ',', ASize, ')');
         Writeln('RegisterTinyHeapBlock(', ptruint(AAddress), ',', ASize, ')');
 {$endif DEBUG_TINY_HEAP}
 {$endif DEBUG_TINY_HEAP}
-        if (ptruint(AAddress) and 1) = 0 then
+        if (ptruint(AAddress) and 1) <> 0 then
           begin
           begin
             Inc(AAddress);
             Inc(AAddress);
             Dec(ASize);
             Dec(ASize);
           end;
           end;
+        if (ASize and 1) <> 0 then
+          Dec(ASize);
         pptruint(AAddress)^ := ASize - SizeOf(ptruint);
         pptruint(AAddress)^ := ASize - SizeOf(ptruint);
         FreeMem(pptruint(AAddress) + 1, ASize - SizeOf(ptruint));
         FreeMem(pptruint(AAddress) + 1, ASize - SizeOf(ptruint));
       end;
       end;