summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/memory.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-15 21:22:13 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-15 21:22:13 (GMT)
commit0611c26a58a937dace420691e797fbea21db619b (patch)
tree20f6c60f778a2e999d299b3b015f01d83a10eb4d /Doc/c-api/memory.rst
parentaf584a02a5dee4250e904ff75d22359aee9c2d70 (diff)
downloadcpython-0611c26a58a937dace420691e797fbea21db619b.zip
cpython-0611c26a58a937dace420691e797fbea21db619b.tar.gz
cpython-0611c26a58a937dace420691e797fbea21db619b.tar.bz2
On memory error, dump the memory block traceback
Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a memory block was allocated on memory block. Use the tracemalloc module to get the traceback.
Diffstat (limited to 'Doc/c-api/memory.rst')
-rw-r--r--Doc/c-api/memory.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst
index 25867d9..843ccac 100644
--- a/Doc/c-api/memory.rst
+++ b/Doc/c-api/memory.rst
@@ -349,12 +349,19 @@ Customize Memory Allocators
allocator functions of the :c:data:`PYMEM_DOMAIN_OBJ` domain (ex:
:c:func:`PyObject_Malloc`) are called
+ On error, the debug hooks use the :mod:`tracemalloc` module to get the
+ traceback where a memory block was allocated. The traceback is only
+ displayed if :mod:`tracemalloc` is tracing Python memory allocations and the
+ memory block was traced.
+
These hooks are installed by default if Python is compiled in debug
mode. The :envvar:`PYTHONMALLOC` environment variable can be used to install
debug hooks on a Python compiled in release mode.
.. versionchanged:: 3.6
This function now also works on Python compiled in release mode.
+ On error, the debug hooks now use :mod:`tracemalloc` to get the traceback
+ where a memory block was allocated.
.. _pymalloc: