tracemalloc.take_snapshot()
tracemalloc.take_snapshot() is a Python function in the Tracemalloc Module category. Takes a snapshot of memory allocations. The syntax is tracemalloc.take_snapshot(). Returns: Snapshot object. A typical example: snap = tracemalloc.take_snapshot(). A close sibling is tracemalloc.start(), which starts tracing memory allocations. A close sibling is tracemalloc.stop(), which stops tracing memory allocations. A close sibling is tracemalloc.get_traced_memory(), which returns (current_size, peak_size) of traced memory in bytes. A close sibling is tracemalloc.Snapshot.statistics(), which returns statistics grouped by the given key type ("filename", "lineno", "traceback"). More about this category: Memory tracing — start, stop, get_traced_memory, Snapshot, take_snapshot. Related Tracemalloc Module entries: tracemalloc.start(), tracemalloc.stop(), tracemalloc.get_traced_memory(), tracemalloc.Snapshot.statistics(), tracemalloc.Snapshot.compare_to(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try tracemalloc.take_snapshot() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.