summary refs log tree commit diff stats
path: root/tests/gc/tregionleak.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gc/tregionleak.nim')
-rw-r--r--tests/gc/tregionleak.nim23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/gc/tregionleak.nim b/tests/gc/tregionleak.nim
new file mode 100644
index 000000000..277cfc987
--- /dev/null
+++ b/tests/gc/tregionleak.nim
@@ -0,0 +1,23 @@
+discard """
+  cmd: '''nim c --gc:regions $file'''
+  output: '''
+finalized
+finalized
+'''
+"""
+
+proc finish(o: RootRef) =
+  echo "finalized"
+
+withScratchRegion:
+  var test: RootRef
+  new(test, finish)
+
+var
+  mr: MemRegion
+  test: RootRef
+
+withRegion(mr):
+  new(test, finish)
+
+deallocAll(mr)