Stats Reporter#

The stats reporter generates high level statistics about the tracked process’s memory allocations.

_images/stats_example.png

The output includes the following:

  • Total number of allocations performed

  • Total amount of memory allocated

  • Histogram displaying the distribution of allocation sizes. The y-axis data (size) is logarithmic.

  • Distribution of allocation types (e.g. MALLOC, CALLOC, MMAP, etc.)

  • Stack trace and size of the top ‘n’ largest allocating locations by size (default: 5, configurable with the -n command line param)

  • Stack trace and count of the top ‘n’ largest allocating locations by number of allocations (default: 5, configurable with the -n command line param)

Basic Usage#

The general form of the stats subcommand is:

memray stats [options] <results>

The only argument the stats subcommand requires is the capture file previously generated using the run subcommand.

The output will be printed directly to the standard output of the terminal.

CLI Reference#

usage: memray stats [-h] [-n NUM_LARGEST] results

Positional Arguments#

results

Results of the tracker run

Named Arguments#

-n, --num-largest

Displays the top ‘n’ largest allocating functions. Default is 5

Default: 5

Please submit feedback, ideas, and bug reports by filing a new issue at https://github.com/bloomberg/memray/issues