]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-112529: Track if debug allocator is used as underlying allocator (#113747)
authorSam Gross <colesbury@gmail.com>
Tue, 16 Jan 2024 21:42:15 +0000 (16:42 -0500)
committerGitHub <noreply@github.com>
Tue, 16 Jan 2024 21:42:15 +0000 (13:42 -0800)
commitb331381485c1965d1c88b7aee7ae9604aca05758
tree17595ab4ee790ebb042c5a9661848623fb79076e
parentc86571e4c9765a88ba05a7d9b874b40af0e1d6ab
gh-112529: Track if debug allocator is used as underlying allocator (#113747)

* gh-112529: Track if debug allocator is used as underlying allocator

The GC implementation for free-threaded builds will need to accurately
detect if the debug allocator is used because it affects the offset of
the Python object from the beginning of the memory allocation. The
current implementation of `_PyMem_DebugEnabled` only considers if the
debug allocator is the outer-most allocator; it doesn't handle the case
of "hooks" like tracemalloc being used on top of the debug allocator.

This change enables more accurate detection of the debug allocator by
tracking when debug hooks are enabled.

* Simplify _PyMem_DebugEnabled
Include/internal/pycore_pymem.h
Include/internal/pycore_pymem_init.h
Include/internal/pycore_runtime_init.h
Objects/obmalloc.c