On this page
  1. tracemalloc.Statistic
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

tracemalloc.Statistic

Prev: tracemalloc.start | Up: tracemalloc | Next: tracemalloc.StatisticDiff
Rel: tracemalloc.BaseFilter, tracemalloc.clear_traces, tracemalloc.DomainFilter, tracemalloc.Filter
Ref: docs.python.org — tracemalloc.Statistic
Tags: #public #python3 #stdlib #tracemalloc


Import

import tracemalloc
from tracemalloc import Statistic

Signature & Overview

tracemalloc.Statistic(traceback, size, count)

Statistic difference on memory allocations between two Snapshot instance.

Usage

import tracemalloc

tracemalloc.start()
try:
    _ = bytearray(10_000)
    stats = tracemalloc.take_snapshot().statistics('lineno')
    assert isinstance(stats[0], tracemalloc.Statistic) and stats[0].size > 0
finally:
    tracemalloc.stop()

Gotchas

REPL Inspect

from tracemalloc import Statistic
help(Statistic)

Linked from

Related notes