ソースを参照

Update maxUsed at the correct moment.

Rika Ichinose 1 ヶ月 前
コミット
49805e0361
1 ファイル変更5 行追加5 行削除
  1. 5 5
      rtl/inc/heap.inc

+ 5 - 5
rtl/inc/heap.inc

@@ -1116,15 +1116,15 @@ type
       size := vSizeFlags and VarSizeMask;
     end;
 
-    { Update maxUsed regardless. }
-    statv := used + gs.hugeUsed;
-    if statv > maxUsed then
-      maxUsed := statv;
-
     if isArena then
       inc(pVarHeader(result)[-1].ch.h, FixedArenaFlag) { Arenas aren’t counted in “used” directly. }
     else
       inc(used, size);
+
+    { Update maxUsed regardless. }
+    statv := used + gs.hugeUsed;
+    if statv > maxUsed then
+      maxUsed := statv;
   end;
 
   function HeapInc.ThreadState.FreeVar(p: pointer): SizeUint;