tracemalloc.Traceback

class tracemalloc.Traceback Sequence of Frame instances sorted from the most recent frame to the oldest frame. A traceback contains at least 1 frame. If the tracemalloc module failed to get a frame, the filename "<unknown>" at line number 0 is used. When a snapshot is taken, tracebacks of traces are limited to get_traceback_limit() frames. See the take_snapshot() function. The Trace.traceback attribute is an instance of Traceback instance. format(limit=None) Format the traceback as

tracemalloc.Trace.traceback

traceback Traceback where the memory block was allocated, Traceback instance.

tracemalloc.Trace.size

size Size of the memory block in bytes (int).

tracemalloc.Trace

class tracemalloc.Trace Trace of a memory block. The Snapshot.traces attribute is a sequence of Trace instances. size Size of the memory block in bytes (int). traceback Traceback where the memory block was allocated, Traceback instance.

tracemalloc.take_snapshot()

tracemalloc.take_snapshot() Take a snapshot of traces of memory blocks allocated by Python. Return a new Snapshot instance. The snapshot does not include memory blocks allocated before the tracemalloc module started to trace memory allocations. Tracebacks of traces are limited to get_traceback_limit() frames. Use the nframe parameter of the start() function to store more frames. The tracemalloc module must be tracing memory allocations to take a snapshot, see the start() function. See also t

tracemalloc.stop()

tracemalloc.stop() Stop tracing Python memory allocations: uninstall hooks on Python memory allocators. Also clears all previously collected traces of memory blocks allocated by Python. Call take_snapshot() function to take a snapshot of traces before clearing them. See also start(), is_tracing() and clear_traces() functions.

tracemalloc.StatisticDiff.traceback

traceback Traceback where the memory blocks were allocated, Traceback instance.

tracemalloc.StatisticDiff.size_diff

size_diff Difference of total size of memory blocks in bytes between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot.

tracemalloc.StatisticDiff.size

size Total size of memory blocks in bytes in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot.

tracemalloc.StatisticDiff.count_diff

count_diff Difference of number of memory blocks between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot.