PEP 454: cleanup
This commit is contained in:
parent
3f24eef138
commit
c4e4fa55cc
50
pep-0454.txt
50
pep-0454.txt
|
@ -134,17 +134,6 @@ Main functions
|
|||
See also ``start()`` and ``stop()`` functions.
|
||||
|
||||
|
||||
``start()`` function:
|
||||
|
||||
Start tracing Python memory allocations.
|
||||
|
||||
The function installs hooks on Python memory allocators. These hooks
|
||||
have important overhead in term of performances and memory usage:
|
||||
see `Filter functions`_ to limit the overhead.
|
||||
|
||||
See also ``stop()`` and ``is_tracing()`` functions.
|
||||
|
||||
|
||||
``stop()`` function:
|
||||
|
||||
Stop tracing Python memory allocations and clear traces of memory
|
||||
|
@ -159,13 +148,24 @@ Main functions
|
|||
See also ``start()`` and ``is_tracing()`` functions.
|
||||
|
||||
|
||||
``start()`` function:
|
||||
|
||||
Start tracing Python memory allocations.
|
||||
|
||||
The function installs hooks on Python memory allocators. These hooks
|
||||
have important overhead in term of performances and memory usage:
|
||||
see `Filter functions`_ to limit the overhead.
|
||||
|
||||
See also ``stop()`` and ``is_tracing()`` functions.
|
||||
|
||||
|
||||
``take_snapshot()`` function:
|
||||
|
||||
Take a snapshot of traces of memory blocks allocated by Python using
|
||||
the ``get_traces()`` function. Return a new ``Snapshot`` instance.
|
||||
|
||||
The ``tracemalloc`` module must be tracing memory allocations to take a
|
||||
snapshot, see the the ``start()`` function.
|
||||
The ``tracemalloc`` module must be tracing memory allocations to
|
||||
take a snapshot, see the the ``start()`` function.
|
||||
|
||||
See also ``get_traces()`` and ``get_object_traceback()`` functions.
|
||||
|
||||
|
@ -175,7 +175,7 @@ Trace functions
|
|||
|
||||
When Python allocates a memory block, ``tracemalloc`` attachs a "trace" to
|
||||
the memory block to store its size in bytes and the traceback where the
|
||||
allocation occured.
|
||||
allocation occurred.
|
||||
|
||||
The following functions give access to these traces. A trace is a ``(size: int,
|
||||
traceback)`` tuple. *size* is the size of the memory block in bytes.
|
||||
|
@ -208,8 +208,8 @@ has a size of 32 bytes and was allocated at ``x.py:7``, line called from line
|
|||
|
||||
Get the maximum number of frames stored in the traceback of a trace.
|
||||
|
||||
By default, a trace of an allocated memory block only stores the
|
||||
most recent frame: the limit is ``1``.
|
||||
By default, a trace of a memory block only stores the most recent
|
||||
frame: the limit is ``1``.
|
||||
|
||||
Use the ``set_traceback_limit()`` function to change the limit.
|
||||
|
||||
|
@ -220,19 +220,19 @@ has a size of 32 bytes and was allocated at ``x.py:7``, line called from line
|
|||
``(size: int, traceback: tuple)`` tuples. *traceback* is a tuple of
|
||||
``(filename: str, lineno: int)`` tuples.
|
||||
|
||||
The list of traces do not include memory blocks allocated before the
|
||||
``tracemalloc`` module started to trace memory allocations nor memory
|
||||
blocks ignored by filters (see ``get_filters()``).
|
||||
The list of traces does not include memory blocks allocated before
|
||||
the ``tracemalloc`` module started to trace memory allocations nor
|
||||
memory blocks ignored by filters (see ``get_filters()``).
|
||||
|
||||
The list is not sorted. Take a snapshot using ``take_snapshot()``
|
||||
and use the ``Snapshot.statistics()`` method to get a sorted list of
|
||||
statistics.
|
||||
The list has an undefined order. Take a snapshot using
|
||||
``take_snapshot()`` and use the ``Snapshot.statistics()`` method to
|
||||
get a sorted list of statistics.
|
||||
|
||||
Tracebacks of traces are limited to ``traceback_limit`` frames. Use
|
||||
``set_traceback_limit()`` to store more frames.
|
||||
|
||||
Return an empty list if the ``tracemalloc`` module is not tracing memory
|
||||
allocations.
|
||||
Return an empty list if the ``tracemalloc`` module is not tracing
|
||||
memory allocations.
|
||||
|
||||
See also ``take_snapshot()`` and ``get_object_traceback()``
|
||||
functions.
|
||||
|
@ -266,7 +266,7 @@ and on the memory usage.
|
|||
To limit the overhead, some files can be excluded or tracing can be restricted
|
||||
to a set of files using filters. Examples: ``add_filter(Filter(True,
|
||||
subprocess.__file__))`` only traces memory allocations in the ``subprocess``
|
||||
module, and ``add_filter(Filter(False, tracemalloc.__file__))`` do not trace
|
||||
module, and ``add_filter(Filter(False, tracemalloc.__file__))`` ignores
|
||||
memory allocations in the ``tracemalloc`` module
|
||||
|
||||
By default, there is one exclusive filter to ignore Python memory blocks
|
||||
|
|
Loading…
Reference in New Issue