Implements alloc/dealloc counters for better leak debugging. (#8384)

This commit is contained in:
Dominik Picheta 2018-07-21 00:43:13 +01:00 • committed by Andreas Rumpf
commit 5ea3b4d581
2 changed files with 16 additions and 0 deletions

View file

@ -57,6 +57,9 @@ when defined(nimTypeNames):
for i in 0 .. n-1:
c_fprintf(stdout, "[Heap] %s: #%ld; bytes: %ld\n", a[i][0], a[i][1], a[i][2])
c_fprintf(stdout, "[Heap] total number of bytes: %ld\n", totalAllocated)
when defined(nimTypeNames):
let (allocs, deallocs) = getMemCounters()
c_fprintf(stdout, "[Heap] allocs/deallocs: %ld/%ld\n", allocs, deallocs)
when defined(nimGcRefLeak):
proc oomhandler() =