proof that refcounting can handle Nim's async (#12533)

This commit is contained in:
Andreas Rumpf
2019-10-28 16:13:38 +01:00
committed by GitHub
parent 160c07be00
commit c52a2c3ab0
3 changed files with 99 additions and 19 deletions

View File

@@ -16,7 +16,8 @@
const
CycleIncrease = 2 # is a multiplicative increase
InitialCycleThreshold = 4*1024*1024 # X MB because cycle checking is slow
InitialCycleThreshold = when defined(nimCycleBreaker): high(int)
else: 4*1024*1024 # X MB because cycle checking is slow
InitialZctThreshold = 500 # we collect garbage if the ZCT's size
# reaches this threshold
# this seems to be a good value
@@ -792,6 +793,12 @@ proc collectCT(gch: var GcHeap) =
collectCTBody(gch)
gch.zctThreshold = max(InitialZctThreshold, gch.zct.len * CycleIncrease)
proc GC_collectZct*() =
## Collect the ZCT (zero count table). Unstable, experimental API for
## testing purposes.
## DO NOT USE!
collectCTBody(gch)
when withRealTime:
proc toNano(x: int): Nanos {.inline.} =
result = x * 1000