summary refs log tree commit diff stats
path: root/tests/arc/tasyncleak.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/tasyncleak.nim')
-rw-r--r--tests/arc/tasyncleak.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/arc/tasyncleak.nim b/tests/arc/tasyncleak.nim
new file mode 100644
index 000000000..8e3a7b3e7
--- /dev/null
+++ b/tests/arc/tasyncleak.nim
@@ -0,0 +1,21 @@
+discard """
+  outputsub: "(allocCount: 4050, deallocCount: 4048)"
+  cmd: "nim c --gc:orc -d:nimAllocStats $file"
+"""
+
+import asyncdispatch
+# bug #15076
+const
+  # Just to occupy some RAM
+  BigData = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+
+proc doNothing(): Future[void] {.async.} =
+  discard
+
+proc main(): Future[void] {.async.} =
+  for x in 0 .. 1_000:
+    await doNothing()
+
+waitFor main()
+GC_fullCollect()
+echo getAllocStats()