From 98805546dbcb738b84a6a23b231b3da7019af0f5 Mon Sep 17 00:00:00 2001 From: bung87 Date: Wed, 2 Aug 2023 18:05:29 +0800 Subject: [PATCH] add test case --- tests/gc/t22173.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/gc/t22173.nim diff --git a/tests/gc/t22173.nim b/tests/gc/t22173.nim new file mode 100644 index 000000000000..3fa3cc5038c9 --- /dev/null +++ b/tests/gc/t22173.nim @@ -0,0 +1,20 @@ +discard """ + cmd: '''nim c --gc:refc -r $file''' +""" +const Memo = 100 * 1024 + +proc fff(v: sink string): iterator(): char = + return iterator(): char = + for c in v: + yield c + +var tmp = newString(Memo) + +let iter = fff(move(tmp)) + +while true: + let v = iter() + if finished(iter): + break + +doAssert getOccupiedMem() < Memo * 3