summary refs log tree commit diff stats
path: root/tests/gc/gcleak2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gc/gcleak2.nim')
-rw-r--r--tests/gc/gcleak2.nim14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/gc/gcleak2.nim b/tests/gc/gcleak2.nim
index fe1718aef..bc943dbe7 100644
--- a/tests/gc/gcleak2.nim
+++ b/tests/gc/gcleak2.nim
@@ -14,8 +14,20 @@ proc makeObj(): TTestObj =
   result.x = "Hello"
   result.s = @[1,2,3]
 
+const numIter =
+  when defined(boehmgc):
+    # super slow because GC_fullcollect() at each iteration; especially
+    # on OSX 10.15 where it takes ~170s
+    # `getOccupiedMem` should be constant after each iteration for i >= 3
+    1_000
+  elif defined(gcMarkAndSweep):
+    # likewise, somewhat slow, 1_000_000 would run for 8s
+    # and same remark as above
+    100_000
+  else: 1_000_000
+
 proc inProc() =
-  for i in 1 .. 1_000_000:
+  for i in 1 .. numIter:
     when defined(gcMarkAndSweep) or defined(boehmgc):
       GC_fullcollect()
     var obj: TTestObj