improvements to memtracking

This commit is contained in:
Andreas Rumpf 2017-01-26 11:25:55 +01:00
commit 05a3c1b10a
5 changed files with 38 additions and 16 deletions

View file

@ -56,8 +56,14 @@ proc add(a: var MemRegion, t: var PAvlNode, key, upperBound: int) {.benign.} =
t = allocAvlNode(a, key, upperBound)
else:
if key <% t.key:
when defined(avlcorruption):
if t.link[0] == nil:
cprintf("bug here %p\n", t)
add(a, t.link[0], key, upperBound)
elif key >% t.key:
when defined(avlcorruption):
if t.link[1] == nil:
cprintf("bug here B %p\n", t)
add(a, t.link[1], key, upperBound)
else:
sysAssert false, "key already exists"