mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 23:05:27 +00:00
proof that refcounting can handle Nim's async (#12533)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user