Explorar o código

* heap manager: fix shrinking var sized chunks to very small sizes < sizeof(tmemchunk_var)
was no problem previously due to sizeof(tmemchunk_var) <= blocksize

git-svn-id: trunk@7464 -

micha %!s(int64=18) %!d(string=hai) anos
pai
achega
f9d2ea7e3a
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      rtl/inc/heap.inc

+ 7 - 1
rtl/inc/heap.inc

@@ -1226,7 +1226,13 @@ begin
       exit;
     end;
 
-  { var memchunck }
+  { var memchunk }
+
+  { do not fragment the heap with small shrinked blocks }
+  {  also solves problem with var sized chunks smaller than sizeof(tmemchunk_var) }
+  if size < maxblocksize div 2 then
+    exit(false);
+
   currsize := chunksize and sizemask;
   size := (size+sizeof(tmemchunk_var_hdr)+(blocksize-1)) and sizemask;