fixes #22256; fixes GC_disableOrc overflow (#22257)

This commit is contained in:
ringabout
2023-07-12 01:01:18 +08:00
committed by GitHub
parent 9ddd768cce
commit 9471b5f964
2 changed files with 10 additions and 1 deletions

View File

@@ -411,7 +411,7 @@ proc registerCycle(s: Cell; desc: PNimTypeV2) =
if roots.d == nil: init(roots)
add(roots, s, desc)
if roots.len >= rootsThreshold+defaultThreshold:
if roots.len - defaultThreshold >= rootsThreshold:
collectCycles()
when logOrc:
writeCell("[added root]", s, desc)

View File

@@ -0,0 +1,9 @@
discard """
joinable: false
"""
import std/asyncdispatch
# bug #22256
GC_disableMarkAndSweep()
waitFor sleepAsync(1000)