diff options
author | Araq <rumpf_a@web.de> | 2017-10-16 12:29:40 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-10-16 12:29:40 +0200 |
commit | 4a7266e1c1ba34318e1aabf5977fb9dc2f19e355 (patch) | |
tree | 493e5a4529cab8f746c780cef75ab2cdc1c23d28 /lib | |
parent | 06854d13466ff3f073ddc33246e03d5039fdf49b (diff) | |
download | Nim-4a7266e1c1ba34318e1aabf5977fb9dc2f19e355.tar.gz |
fixes #3558
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/alloc.nim | 15 | ||||
-rw-r--r-- | lib/system/gc.nim | 17 |
2 files changed, 17 insertions, 15 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index 78db96e77..19d27e7d2 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -301,13 +301,14 @@ proc pageAddr(p: pointer): PChunk {.inline.} = result = cast[PChunk](cast[ByteAddress](p) and not PageMask) #sysAssert(Contains(allocator.chunkStarts, pageIndex(result))) -proc writeFreeList(a: MemRegion) = - var it = a.freeChunksList - c_fprintf(stdout, "freeChunksList: %p\n", it) - while it != nil: - c_fprintf(stdout, "it: %p, next: %p, prev: %p, size: %ld\n", - it, it.next, it.prev, it.size) - it = it.next +when false: + proc writeFreeList(a: MemRegion) = + var it = a.freeChunksList + c_fprintf(stdout, "freeChunksList: %p\n", it) + while it != nil: + c_fprintf(stdout, "it: %p, next: %p, prev: %p, size: %ld\n", + it, it.next, it.prev, it.size) + it = it.next const nimMaxHeap {.intdefine.} = 0 diff --git a/lib/system/gc.nim b/lib/system/gc.nim index a2ff72a30..21757cf78 100644 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -155,14 +155,15 @@ template setColor(c, col) = else: c.refcount = c.refcount and not colorMask or col -proc writeCell(msg: cstring, c: PCell) = - var kind = -1 - var typName: cstring = "nil" - if c.typ != nil: - kind = ord(c.typ.kind) - when defined(nimTypeNames): - if not c.typ.name.isNil: - typName = c.typ.name +when defined(logGC): + proc writeCell(msg: cstring, c: PCell) = + var kind = -1 + var typName: cstring = "nil" + if c.typ != nil: + kind = ord(c.typ.kind) + when defined(nimTypeNames): + if not c.typ.name.isNil: + typName = c.typ.name when leakDetector: c_fprintf(stdout, "[GC] %s: %p %d %s rc=%ld from %s(%ld)\n", |