tracemalloc.Traceback.format()

format(limit=None) Format the traceback as a list of lines with newlines. Use the linecache module to retrieve lines from the source code. If limit is set, only format the limit most recent frames. Similar to the traceback.format_tb() function, except that format() does not include newlines. Example: print("Traceback (most recent call first):") for line in traceback: print(line) Output: Traceback (most recent call first): File "test.py", line 9 obj = Object() File "test.py", lin

True

True The true value of the bool type. Assignments to True are illegal and raise a SyntaxError.

tracemalloc.Trace.size

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

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.traceback

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

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.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.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.Statistic.traceback

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