From d9c922fc70b226b1c64c11d5ed3599c7b9322fd5 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Thu, 18 Jan 2018 11:04:32 +0300 Subject: [PATCH] Fix gc tests for BoehmGC (#7094) --- tests/gc/gcleak.nim | 3 +-- tests/gc/gcleak2.nim | 4 +--- tests/gc/gcleak4.nim | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/gc/gcleak.nim b/tests/gc/gcleak.nim index 4e47db609..8852a8d91 100644 --- a/tests/gc/gcleak.nim +++ b/tests/gc/gcleak.nim @@ -13,11 +13,10 @@ proc MakeObj(): TTestObj = result.x = "Hello" for i in 1 .. 1_000_000: - when defined(gcMarkAndSweep): + when defined(gcMarkAndSweep) or defined(boehmgc): GC_fullcollect() var obj = MakeObj() if getOccupiedMem() > 300_000: quit("still a leak!") # echo GC_getstatistics() echo "no leak: ", getOccupiedMem() - diff --git a/tests/gc/gcleak2.nim b/tests/gc/gcleak2.nim index 101421683..facb8a008 100644 --- a/tests/gc/gcleak2.nim +++ b/tests/gc/gcleak2.nim @@ -16,7 +16,7 @@ proc MakeObj(): TTestObj = proc inProc() = for i in 1 .. 1_000_000: - when defined(gcMarkAndSweep): + when defined(gcMarkAndSweep) or defined(boehmgc): GC_fullcollect() var obj: TTestObj obj = MakeObj() @@ -24,5 +24,3 @@ proc inProc() = inProc() echo "no leak: ", getOccupiedMem() - - diff --git a/tests/gc/gcleak4.nim b/tests/gc/gcleak4.nim index d93a13854..e9b17e557 100644 --- a/tests/gc/gcleak4.nim +++ b/tests/gc/gcleak4.nim @@ -38,7 +38,7 @@ proc newPlus(a, b: ref TExpr): ref TPlusExpr = result.b = b result.op2 = $getOccupiedMem() -const Limit = when compileOption("gc", "markAndSweep"): 5*1024*1024 else: 500_000 +const Limit = when compileOption("gc", "markAndSweep") or compileOption("gc", "boehm"): 5*1024*1024 else: 500_000 for i in 0..100_000: var s: array[0..11, ref TExpr]