diff options
author | Christopher Dunn <cdunn2001@gmail.com> | 2018-08-05 02:53:10 -0500 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-08-05 09:53:10 +0200 |
commit | cc1fd50b2785cdb6ec14f283bc7d7ef87f64dd9e (patch) | |
tree | fdbbc3c1128c5eb625f61c3754514a82e940c321 | |
parent | 96c6c82d5592a7a19006c0fb161a74178cea9700 (diff) | |
download | Nim-cc1fd50b2785cdb6ec14f283bc7d7ef87f64dd9e.tar.gz |
Try to let memTracker compile (#8502)
-rw-r--r-- | lib/system/alloc.nim | 10 | ||||
-rw-r--r-- | lib/system/memtracker.nim | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index ffb7aaf86..b090117a9 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -454,10 +454,10 @@ proc requestOsChunks(a: var MemRegion, size: int): PBigChunk = a.addHeapLink(result, size) when defined(debugHeapLinks): cprintf("owner: %p; result: %p; next pointer %p; size: %ld\n", addr(a), - result, result.heapLink, result.origSize) + result, result.heapLink, result.size) when defined(memtracker): - trackLocation(addr result.origSize, sizeof(int)) + trackLocation(addr result.size, sizeof(int)) sysAssert((cast[ByteAddress](result) and PageMask) == 0, "requestOsChunks 1") #zeroMem(result, size) @@ -527,7 +527,7 @@ proc updatePrevSize(a: var MemRegion, c: PBigChunk, proc splitChunk2(a: var MemRegion, c: PBigChunk, size: int): PBigChunk = result = cast[PBigChunk](cast[ByteAddress](c) +% size) result.size = c.size - size - track("result.origSize", addr result.origSize, sizeof(int)) + track("result.size", addr result.size, sizeof(int)) # XXX check if these two nil assignments are dead code given # addChunkToMatrix's implementation: result.next = nil @@ -602,7 +602,7 @@ proc getBigChunk(a: var MemRegion, size: int): PBigChunk = splitChunk(a, result, size) # set 'used' to to true: result.prevSize = 1 - track("setUsedToFalse", addr result.origSize, sizeof(int)) + track("setUsedToFalse", addr result.size, sizeof(int)) incl(a, a.chunkStarts, pageIndex(result)) dec(a.freeMem, size) @@ -968,7 +968,7 @@ proc deallocOsPages(a: var MemRegion) = let (p, size) = it.chunks[i] when defined(debugHeapLinks): cprintf("owner %p; dealloc A: %p size: %ld; next: %p\n", addr(a), - it, it.origSize, next) + it, it.size, next) sysAssert size >= PageSize, "origSize too small" osDeallocPages(p, size) it = next diff --git a/lib/system/memtracker.nim b/lib/system/memtracker.nim index ae0297438..1b1f18039 100644 --- a/lib/system/memtracker.nim +++ b/lib/system/memtracker.nim @@ -73,12 +73,12 @@ proc addEntry(entry: LogEntry) = let x = cast[proc() {.nimcall, tags: [], gcsafe, locks: 0.}](writeStackTrace) x() quit 1 - if gLog.count > high(gLog.data): - gLogger(gLog) - gLog.count = 0 - gLog.data[gLog.count] = entry - inc gLog.count - gLog.disabled = false + #if gLog.count > high(gLog.data): + # gLogger(gLog) + # gLog.count = 0 + #gLog.data[gLog.count] = entry + #inc gLog.count + #gLog.disabled = false proc memTrackerWrite(address: pointer; size: int; file: cstring; line: int) {.compilerProc.} = addEntry LogEntry(op: "write", address: address, |