summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-01-18 10:46:23 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-01-18 10:46:23 +0100
commit03b7df74a9f50d619c8293beb68efa878e327393 (patch)
treeaee4e366d628e164c3f8e4729a953a6ba6272a42
parentffd8e922a1b57241de092b25360ba7bd1706b58a (diff)
downloadNim-03b7df74a9f50d619c8293beb68efa878e327393.tar.gz
alloc.nim: Make 'logAlloc' produce a toy Nim program for easier memory tracing
-rw-r--r--lib/system/alloc.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim
index 46f75396b..f1f3cdb6c 100644
--- a/lib/system/alloc.nim
+++ b/lib/system/alloc.nim
@@ -689,7 +689,7 @@ proc rawAlloc(a: var MemRegion, requestedSize: int): pointer =
     add(a, a.root, cast[ByteAddress](result), cast[ByteAddress](result)+%size)
   sysAssert(isAccessible(a, result), "rawAlloc 14")
   sysAssert(allocInv(a), "rawAlloc: end")
-  when logAlloc: cprintf("rawAlloc: %ld %p\n", requestedSize, result)
+  when logAlloc: cprintf("var pointer_%p = alloc(%ld)\n", result, requestedSize)
 
 proc rawAlloc0(a: var MemRegion, requestedSize: int): pointer =
   result = rawAlloc(a, requestedSize)
@@ -737,7 +737,7 @@ proc rawDealloc(a: var MemRegion, p: pointer) =
     del(a, a.root, cast[int](addr(c.data)))
     freeBigChunk(a, c)
   sysAssert(allocInv(a), "rawDealloc: end")
-  when logAlloc: cprintf("rawDealloc: %p\n", p)
+  when logAlloc: cprintf("dealloc(pointer_%p)\n", p)
 
 proc isAllocatedPtr(a: MemRegion, p: pointer): bool =
   if isAccessible(a, p):