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

tracemalloc.take_snapshot

Prev: tracemalloc.stop | Up: tracemalloc | Next: tracemalloc.total_ordering
Rel: tracemalloc.BaseFilter, tracemalloc.clear_traces, tracemalloc.DomainFilter, tracemalloc.Filter
Ref: docs.python.org — tracemalloc.take_snapshot
Tags: #public #python3 #stdlib #tracemalloc


Import

import tracemalloc
from tracemalloc import take_snapshot

Signature & Overview

tracemalloc.take_snapshot()

Take a snapshot of traces of memory blocks allocated by Python.

Usage

import tracemalloc

tracemalloc.start()
try:
    snap = tracemalloc.take_snapshot()
    assert isinstance(snap, tracemalloc.Snapshot)
finally:
    tracemalloc.stop()

Gotchas

REPL Inspect

from tracemalloc import take_snapshot
help(take_snapshot)

Linked from

Related notes