summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-01-21 23:51:54 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-01-21 23:51:54 +0100
commit6e145d426934489e32fde9a01969cb3117fd33de (patch)
tree5ee6b89af77ecf77c2e379a64ac92b2c4896ddf1 /lib
parent45c02af2b5af0caecbdd163c0a1077a194530eaf (diff)
downloadNim-6e145d426934489e32fde9a01969cb3117fd33de.tar.gz
GC: also report total GC'ed heap size ignoring losses due to fragmentation
Diffstat (limited to 'lib')
-rw-r--r--lib/system/gc_common.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/system/gc_common.nim b/lib/system/gc_common.nim
index 093a379a5..246e55f14 100644
--- a/lib/system/gc_common.nim
+++ b/lib/system/gc_common.nim
@@ -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() =