diff options
author | GordonBGood <GordonBGood@users.noreply.github.com> | 2021-07-12 16:55:40 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 11:55:40 +0200 |
commit | 9ffc70851b586dbdc579d8c6af30a6a3604d7313 (patch) | |
tree | 5a1511e255813a8b810cc2e7f07efe3471a81982 /tests/arc | |
parent | 980a9ed5239ef03e73946ffcc84671a6eaa35616 (diff) | |
download | Nim-9ffc70851b586dbdc579d8c6af30a6a3604d7313.tar.gz |
thamming_orc test created/destroyed counts match (#18471)
The thamming_orc.nim code now counts all created objects being tested, not just the ones following the "first 20" test, and the position of the `destroyed += 1` counter has been adjusted so it counts all the calls that are as a result of `=trace` tracing and not just the original destruction calls.
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/thamming_orc.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/arc/thamming_orc.nim b/tests/arc/thamming_orc.nim index 463f7117e..777efb38e 100644 --- a/tests/arc/thamming_orc.nim +++ b/tests/arc/thamming_orc.nim @@ -1,6 +1,6 @@ discard """ output: '''(allocCount: 1114, deallocCount: 1112) -created 439 destroyed 402''' +created 491 destroyed 491''' cmd: "nim c --gc:orc -d:nimAllocStats $file" """ @@ -94,8 +94,8 @@ type var destroyed = 0 proc `=destroy`(ll: var LazyListObj) = - if ll.tlf == nil and ll.tl == nil: return destroyed += 1 + if ll.tlf == nil and ll.tl == nil: return when defined(trace20): echo "destroying: ", (destroyed, ll.hd[1].convertTriVal2BigInt) @@ -140,7 +140,7 @@ proc main = "Algorithmic error finding first 20 Hamming numbers!!!" when not defined(trace20): - var lsth: TriVal; created = 0; destroyed = 0 + var lsth: TriVal for h in hammings(200): lsth = h doAssert $lsth.convertTriVal2BigInt == "16200", "Algorithmic error finding 200th Hamming number!!!" @@ -149,7 +149,7 @@ let mem = getOccupiedMem() main() GC_FullCollect() let mb = getOccupiedMem() - mem -#doAssert mb == 0, "Found memory leak of " & $mb & " bytes!!!" +doAssert mb == 0, "Found memory leak of " & $mb & " bytes!!!" echo getAllocStats() echo "created ", created, " destroyed ", destroyed |