Artifact
80484e347c3c58890ef4d9d376654da343a3df59:
Attachment "meminfo.tcl" to
ticket [a3309d01db]
added by
aspect
2015-07-15 23:59:46.
(unpublished)
if {[namespace which memory] eq ""} {
error "Needs Tcl with \[memory] command enabled!"
}
set ::meminfo 0
proc meminfo {} {
variable lastmeminfo
dict incr lastmeminfo {bytes}
set inf [memory info]
foreach {_ k v} [regexp -all -inline -line {^(.*?) *(\d+)$} $inf] {
dict set mem $k $v
}
dict with mem {
puts "total alloc = [expr {${current bytes allocated}}]"
puts "step alloc = [expr {${current bytes allocated} - [dict get $lastmeminfo bytes]}]"
puts "mallocs-frees = [expr {${total mallocs}-${total frees}}]"
dict set lastmeminfo {bytes} ${current bytes allocated}
}
}