]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 20 Jul 2025 08:55:06 +0000 (10:55 +0200)
committerGitHub <noreply@github.com>
Sun, 20 Jul 2025 08:55:06 +0000 (10:55 +0200)
commitcce38eefd4b8f4e90eaa40ebfda64cb5ffde679f
treea1fdd338ee6e7c1ecb29bfdf930ade1b63bebb68
parent197f3eca2a48dfa28533645029a926f241e0f25d
[3.14] Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790) (GH-136798)

Extend the documentation for disabling pymalloc with the `--without-pymalloc` flag regarding why it is worth to use it when enabling AddressSanitizer for Python build (which is done, e.g., in CPython's CI builds).

I have tested the CPython latest main build with both ASan and pymalloc enabled and it seems to work just fine. I did run the `python -m test` suite which didn't uncover any ASan crashes (though, it detected some memory leaks, which I believe are irrelevant here).

I have discussed ASan and this flag with @encukou on the CPython Core sprint on EuroPython 2025. We initially thought that the `--without-pymalloc` flag is needed for ASan builds due to the fact pymalloc must hit the begining of page when determining if the memory to be freed comes from pymalloc or was allocated by the system malloc. In other words, we thought, that ASan would crash CPython during free of big objects (allocated by system malloc). It may be that this was the case in the past, but it is not the case anymore as the `address_in_range` function used by pymalloc is annotated to be skipped from the ASan instrumentation.

(cherry picked from commit d19bb4471331ca2cb87b86e4c904bc9a2bafb044)

Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/c-api/memory.rst
Doc/using/configure.rst