GC: also report total GC'ed heap size ignoring losses due to fragmentation
This commit is contained in:
parent
45c02af2b5
commit
6e145d4269
1 changed files with 3 additions and 1 deletions
|
|
@ -46,15 +46,17 @@ when defined(nimTypeNames):
|
|||
var a: InstancesInfo
|
||||
var n = 0
|
||||
var it = nimTypeRoot
|
||||
var totalAllocated = 0
|
||||
while it != nil:
|
||||
if (it.instances > 0 or it.sizes != 0) and n < a.len:
|
||||
a[n] = (it.name, it.instances, it.sizes)
|
||||
inc n
|
||||
inc totalAllocated, it.sizes
|
||||
it = it.nextType
|
||||
sortInstances(a, n)
|
||||
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(nimGcRefLeak):
|
||||
proc oomhandler() =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue