summaryrefslogtreecommitdiffstats
path: root/Include/pymem.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-10-23 15:39:40 (GMT)
committerGitHub <noreply@github.com>2018-10-23 15:39:40 (GMT)
commit82af0b63b07aa8d92b50098e382b458143cfc677 (patch)
tree77c2d497083f78ad622f75ffeb9680c6583d3317 /Include/pymem.h
parent96f2c739542d48edd6bd15c26b555c7e59d14cce (diff)
downloadcpython-82af0b63b07aa8d92b50098e382b458143cfc677.zip
cpython-82af0b63b07aa8d92b50098e382b458143cfc677.tar.gz
cpython-82af0b63b07aa8d92b50098e382b458143cfc677.tar.bz2
bpo-9263: _PyObject_Dump() detects freed memory (GH-10061)
_PyObject_Dump() now uses an heuristic to check if the object memory has been freed: log "<freed object>" in that case. The heuristic rely on the debug hooks on Python memory allocators which fills the memory with DEADBYTE (0xDB) when memory is deallocated. Use PYTHONMALLOC=debug to always enable these debug hooks.
Diffstat (limited to 'Include/pymem.h')
-rw-r--r--Include/pymem.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/pymem.h b/Include/pymem.h
index 8ee0efd..ef6e0bb 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -55,7 +55,9 @@ PyAPI_FUNC(int) PyTraceMalloc_Untrack(
PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
unsigned int domain,
uintptr_t ptr);
-#endif /* !Py_LIMITED_API */
+
+PyAPI_FUNC(int) _PyMem_IsFreed(void *ptr, size_t size);
+#endif /* !defined(Py_LIMITED_API) */
/* BEWARE: