From 98cdfe073e827f05a8de02ffdce6e5f5d377f308 Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 13 Jan 2019 14:24:38 +0100 Subject: [PATCH] fixes #10271 [backport] (cherry picked from commit 451377f737ab4b21a96c1ca3f3646c86c275a2b3) --- lib/system/gc_ms.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/system/gc_ms.nim b/lib/system/gc_ms.nim index 96221b175b838..13a56e8327c77 100644 --- a/lib/system/gc_ms.nim +++ b/lib/system/gc_ms.nim @@ -497,8 +497,9 @@ proc collectCTBody(gch: var GcHeap) = sysAssert(allocInv(gch.region), "collectCT: end") proc collectCT(gch: var GcHeap; size: int) = + let fmem = getFreeMem(gch.region) if (getOccupiedMem(gch.region) >= gch.cycleThreshold or - size > getFreeMem(gch.region)) and gch.recGcLock == 0: + size > fmem and fmem > InitialThreshold) and gch.recGcLock == 0: collectCTBody(gch) when not defined(useNimRtl):