PEP 454: add get/set_number_frame()

This commit is contained in:
Victor Stinner 2013-09-05 23:15:45 +02:00
parent 960ec4e01e
commit 2a8d38e264
1 changed files with 27 additions and 10 deletions

View File

@ -66,23 +66,30 @@ enabled as early as possible in your application by calling
environment variable to ``1``, or by using ``-X tracemalloc`` command
line option.
By default, tracemalloc only stores one ``frame`` instance per memory
allocation. Use ``tracemalloc.set_number_frame()`` to store more frames.
Functions
---------
``enable()`` function:
``clear_traces()`` function:
Start tracing Python memory allocations.
Clear all traces and statistics of memory allocations.
``disable()`` function:
Stop tracing Python memory allocations and stop the timer started by
``start_timer()``.
``is_enabled()`` function:
``enable()`` function:
Get the status of the module: ``True`` if it is enabled, ``False``
otherwise.
Start tracing Python memory allocations.
``get_number_frame()`` function:
Get the maximum number of frames stored in a trace of a memory
allocation.
``get_object_address(obj)`` function:
@ -120,15 +127,25 @@ Functions
Return an empty dictionary if the tracemalloc module is disabled.
``get_traces(obj)`` function:
Get all traces of a Python memory allocations.
Return a dictionary ``{pointer: int -> trace}`` where *trace*
is a ``trace`` instance.
Get all traces of a Python memory allocations.
Return a dictionary ``{pointer: int -> trace}`` where *trace*
is a ``trace`` instance.
Return an empty dictionary if the ``tracemalloc`` module is disabled.
Return an empty dictionary if the ``tracemalloc`` module is disabled.
``is_enabled()`` function:
Get the status of the module: ``True`` if it is enabled, ``False``
otherwise.
``set_number_frame(nframe: int)`` function:
Set the maximum number of frames stored in a trace of a memory
allocation.
All traces and statistics of memory allocations are cleared.
``start_timer(delay: int, func: callable, args: tuple=(), kwargs: dict={})`` function: