浏览代码

* allocate always a minimum block size, else free list management causes memory corruption

git-svn-id: trunk@34930 -
florian 8 年之前
父节点
当前提交
16fa079a2a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      rtl/embedded/heapmgr.pp

+ 4 - 1
rtl/embedded/heapmgr.pp

@@ -49,7 +49,10 @@ Unit heapmgr;
         p, prev: PHeapBlock;
         AllocSize, RestSize: ptruint;
       begin
-        AllocSize := align(size+sizeof(pointer), sizeof(pointer));
+        if size<MinBlock then
+          AllocSize := MinBlock
+        else
+          AllocSize := align(size, sizeof(pointer));
 
         p := Blocks;
         prev := nil;