diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-07-12 01:01:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 19:01:18 +0200 |
commit | 9471b5f964395f9b4f4f673239d4375e1910bfaa (patch) | |
tree | 6aad5c65586234f041418ae1c7396c8fb842cbbd | |
parent | 9ddd768cce291e5c562cde23baeeefb47aa79c86 (diff) | |
download | Nim-9471b5f964395f9b4f4f673239d4375e1910bfaa.tar.gz |
fixes #22256; fixes GC_disableOrc overflow (#22257)
-rw-r--r-- | lib/system/orc.nim | 2 | ||||
-rw-r--r-- | tests/gc/tdisable_orc.nim | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/system/orc.nim b/lib/system/orc.nim index 193540710..b7b98c340 100644 --- a/lib/system/orc.nim +++ b/lib/system/orc.nim @@ -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) diff --git a/tests/gc/tdisable_orc.nim b/tests/gc/tdisable_orc.nim new file mode 100644 index 000000000..b5f161c79 --- /dev/null +++ b/tests/gc/tdisable_orc.nim @@ -0,0 +1,9 @@ +discard """ + joinable: false +""" + +import std/asyncdispatch + +# bug #22256 +GC_disableMarkAndSweep() +waitFor sleepAsync(1000) |