]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] 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:40 +0000 (10:55 +0200)
committerGitHub <noreply@github.com>
Sun, 20 Jul 2025 08:55:40 +0000 (10:55 +0200)
Extends 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).

(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

index f7618a025ba3d8ec83d85965c867b433268aa53b..1d0e6c399a567899a6e2652238ea03e68386cf92 100644 (file)
@@ -656,6 +656,10 @@ This allocator is disabled if Python is configured with the
 :option:`--without-pymalloc` option. It can also be disabled at runtime using
 the :envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``).
 
+Typically, it makes sense to disable the pymalloc allocator when building
+Python with AddressSanitizer (:option:`--with-address-sanitizer`) which helps
+uncover low level bugs within the C code.
+
 Customize pymalloc Arena Allocator
 ----------------------------------
 
index aa2edd5dd7f29d4a9dbca81f9b27c041c1f93f69..ba69b68d977279828fdb432fd7dc4f8eb8636256 100644 (file)
@@ -771,6 +771,9 @@ Debug options
 .. option:: --with-address-sanitizer
 
    Enable AddressSanitizer memory error detector, ``asan`` (default is no).
+   To improve ASan detection capabilities you may also want to combine this
+   with :option:`--without-pymalloc` to disable the specialized small-object
+   allocator whose allocations are not tracked by ASan.
 
    .. versionadded:: 3.6