The tree reporter provides a simplified representation of the call hierarchy of the tracked process at the time when its memory usage was at its peak.
The tree reporter shows some statistics followed by a tree representation of the allocated memory. Several aspects are important when interpreting the tree representation:
Only the 10 source locations responsible for the most allocated bytes are displayed. This is configurable with the
--biggest-allocscommand line parameter.
The total memory and percentage shown in the root node of the tree are calculated based only on the allocations that are shown. Since any allocation not big enough to be shown will not be included there, the reported total memory of the root node is normally less than the process’s peak memory size.
Call chains of one node are collapsed for better readability. This means that branches in the tree where each node has only one child are collapsed and a special node is shown to reflect this. The hidden frames never correspond to frames that contained one of the source locations with the biggest allocations. The hidden frames are always callers of functions where the reported allocation happened.
The “📂” icon represents a frame that is a caller of a function where an allocation happened while the “📄” icon represents a frame that allocated memory.
Frames are colored based on their reported memory usage percentage, from red (most bytes allocated) to green (fewest).
The general form of the
tree subcommand is:
memray tree [options] <results>
The only argument the
tree subcommand requires is the capture file
previously generated using the run subcommand.
The output will be printed directly to standard output. If standard output is a terminal, the output will be colorized.
usage: memray tree [-h] [-b BIGGEST_ALLOCS] [--temporary-allocation-threshold N | --temporary-allocations] results
Results of the tracker run
- -b, --biggest-allocs
Show n biggest allocations (defaults to 10)
Report temporary allocations, as opposed to leaked allocations or high watermark allocations. An allocation is considered temporary if at most N other allocations occur before it is deallocated. With N=0, an allocation is temporary only if it is immediately deallocated before any other allocation occurs.
Equivalent to --temporary-allocation-threshold=1
Please submit feedback, ideas, and bug reports by filing a new issue at https://github.com/bloomberg/memray/issues