[Python-Dev] RFC: PEP 454: Add a new tracemalloc module

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Sep 5 02:46:21 CEST 2013


On Tue, Sep 3, 2013 at 7:27 PM, Victor Stinner <victor.stinner at gmail.com>wrote:

> API
> ===
>
> To trace the most Python memory allocations, the module should be
> enabled as early as possible in your application by calling
> ``tracemalloc.enable()`` function, by setting the ``PYTHONTRACEMALLOC``
> environment variable to ``1``, or  by using ``-X tracemalloc`` command
> line option.
>
>
> Functions
> ---------
>
> ``enable()`` function:
>
>     Start tracing Python memory allocations.
>
> ``disable()`` function:
>
>     Stop tracing Python memory allocations and stop the timer started by
>     ``start_timer()``.
>
> ``is_enabled()`` function:
>
>     Get the status of the module: ``True`` if it is enabled, ``False``
>     otherwise.
>

Please mention that this API is similar to that of faulthandler and add a
link to faulthandler docs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130904/311e3a96/attachment.html>


More information about the Python-Dev mailing list