Python Tracemalloc Module
Memory tracing — start, stop, get_traced_memory, Snapshot, take_snapshot. This category documents 6 Python tracemalloc module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: tracemalloc.start(), tracemalloc.stop(), tracemalloc.get_traced_memory(), tracemalloc.take_snapshot(), tracemalloc.Snapshot.statistics(), tracemalloc.Snapshot.compare_to(). tracemalloc.start() starts tracing memory allocations. tracemalloc.stop() stops tracing memory allocations. tracemalloc.get_traced_memory() returns (current_size, peak_size) of traced memory in bytes. tracemalloc.take_snapshot() takes a snapshot of memory allocations. tracemalloc.Snapshot.statistics() returns statistics grouped by the given key type ("filename", "lineno", "traceback"). Tracemalloc Module belongs to the Dev Tools group alongside Inspect Module, Pdb Module, Traceback Module, Timeit Module. You can also search across every category from the search page, browse the complete A–Z index, or try any example in the Python playground. Python Reference documents 978+ functions, methods, and modules across 114 categories of the standard library, and every entry in this Tracemalloc Module category follows the same format — syntax first, then what it does, the parameters it accepts, what it returns, and a working code example — so once you have read one page you can read them all.