heap-stats. ( -- ) - Factor Documentation (original) (raw)

heap-stats. ( -- )
Factor handbook » Developer tools » Object memory tools

Prev: room. ( -- )
Next: heap-stats ( -- counts sizes )

Vocabulary
tools.memory

Word description
For each class, prints the number of instances and total memory consumed by those instances.

See also
heap-stats

Definition

USING: assocs io io.styles kernel prettyprint sequences sorting
;

IN: tools.memory

: heap-stats. ( -- )
heap-stats dup keys sort standard-table-style [
[ { "Class" "Bytes" "Instances" } [ write-cell ] each ]
with-row [
[
dup pprint-cell dup pick at pprint-cell pick at
pprint-cell
] with-row
] each 2drop
] tabular-output nl ;