summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-05 22:31:54 (GMT)
committerGitHub <noreply@github.com>2019-03-05 22:31:54 (GMT)
commita9df651eb4c18a07ec309df190419613e95cba7b (patch)
tree8c014426433938a9c94e7555b20eb13d78369cfa /Objects
parentd8b3a98c9098c66a714fd5593e1928af0ffbc631 (diff)
downloadcpython-a9df651eb4c18a07ec309df190419613e95cba7b.zip
cpython-a9df651eb4c18a07ec309df190419613e95cba7b.tar.gz
cpython-a9df651eb4c18a07ec309df190419613e95cba7b.tar.bz2
bpo-36142: Add _PyMem_GetDebugAllocatorsName() (GH-12185)
The development mode now uses the effective name of the debug memory allocator ("pymalloc_debug" or "malloc_debug"). So the name doesn't change after setting the memory allocator.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/obmalloc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 1c2a320..1afbcca 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -221,6 +221,20 @@ static PyMemAllocatorEx _PyObject = PYOBJ_ALLOC;
#endif
+/* Get the effective name of "debug" memory allocators,
+ as if _PyMem_GetAllocatorsName() is called after
+ _PyMem_SetupAllocators("debug"). */
+const char*
+_PyMem_GetDebugAllocatorsName(void)
+{
+#ifdef WITH_PYMALLOC
+ return "pymalloc_debug";
+#else
+ return "malloc_debug";
+#endif
+}
+
+
static int
pymem_set_default_allocator(PyMemAllocatorDomain domain, int debug,
PyMemAllocatorEx *old_alloc)