diff options
author | Dean Thompson <deansherthompson@gmail.com> | 2019-01-21 16:40:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-21 16:40:04 -0500 |
commit | a6de0274ee768d135bab280d2b2700a0bb475300 (patch) | |
tree | 176b91e837ab7d2217713665c16fc28163017960 /tests/gc/thavlak.nim | |
parent | 5b39c7aca91c1d20eb81425cf8f3854876aed475 (diff) | |
parent | ee89ba6bdb664fe4972f2917499cff1afdac0bab (diff) | |
download | Nim-a6de0274ee768d135bab280d2b2700a0bb475300.tar.gz |
Merge pull request #1 from nim-lang/devel
Getting the latest from nim-lang
Diffstat (limited to 'tests/gc/thavlak.nim')
-rw-r--r-- | tests/gc/thavlak.nim | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/gc/thavlak.nim b/tests/gc/thavlak.nim index 09c07785e..2d8df7c1a 100644 --- a/tests/gc/thavlak.nim +++ b/tests/gc/thavlak.nim @@ -12,9 +12,10 @@ Found 1 loops (including artificial root node) (5)''' # bug #3184 -import tables -import sequtils -import sets +import tables, sequtils, sets, strutils + +when not declared(withScratchRegion): + template withScratchRegion(body: untyped) = body type BasicBlock = object @@ -418,8 +419,9 @@ proc run(self: var LoopTesterApp) = echo "15000 dummy loops" for i in 1..15000: - var h = newHavlakLoopFinder(self.cfg, newLsg()) - var res = h.findLoops + withScratchRegion: + var h = newHavlakLoopFinder(self.cfg, newLsg()) + var res = h.findLoops echo "Constructing CFG..." var n = 2 @@ -446,12 +448,17 @@ proc run(self: var LoopTesterApp) = var sum = 0 for i in 1..5: - write stdout, "." - flushFile(stdout) - var hlf = newHavlakLoopFinder(self.cfg, newLsg()) - sum += hlf.findLoops - #echo getOccupiedMem() + withScratchRegion: + write stdout, "." + flushFile(stdout) + var hlf = newHavlakLoopFinder(self.cfg, newLsg()) + sum += hlf.findLoops + #echo getOccupiedMem() echo "\nFound ", loops, " loops (including artificial root node) (", sum, ")" + when false: + echo("Total memory available: " & formatSize(getTotalMem()) & " bytes") + echo("Free memory: " & formatSize(getFreeMem()) & " bytes") + var l = newLoopTesterApp() l.run |