fixes #10271 [backport]

(cherry picked from commit 451377f737)
This commit is contained in:
Araq
2019-01-13 14:24:38 +01:00
committed by narimiran
parent efa75215e6
commit 98cdfe073e

View File

@@ -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):