On this page
tracemalloc.start
Prev: tracemalloc.Snapshot | Up: tracemalloc | Next: tracemalloc.Statistic
Rel: tracemalloc.BaseFilter, tracemalloc.clear_traces, tracemalloc.DomainFilter, tracemalloc.Filter
Ref: docs.python.org — tracemalloc.start
Tags: #public #python3 #stdlib #tracemalloc
Import
import tracemalloc
from tracemalloc import start
Signature & Overview
tracemalloc.start(nframe=1, /)
Start tracing Python memory allocations.
Usage
import tracemalloc
tracemalloc.start(5)
try:
assert tracemalloc.is_tracing() is True
finally:
tracemalloc.stop()
Gotchas
- Noticeable CPU/RAM overhead: Enable in profiling runs or via
PYTHONTRACEMALLOC=5, not permanently in latency-sensitive production.
REPL Inspect
from tracemalloc import start
help(start)
Linked from
Related notes
- tuts/python3/stdlib_module/tracemalloc/Snapshot Linked here; links to this page; shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/Statistic Linked here; links to this page; shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/tracemalloc/BaseFilter Linked here; shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/clear_traces Linked here; shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/DomainFilter Linked here; shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/Filter Linked here; shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/Frame shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/get_object_traceback shared tags: #stdlib, #tracemalloc
- tuts/python3/stdlib_module/tracemalloc/get_traceback_limit shared tags: #stdlib, #tracemalloc