Consider using ASAN-instrumented CPython build in CI
There is an asan test environment in the tox setup, but it looks like it's set up to use a "regular" build of CPython instead of one that has ASAN instrumentation. If you build CPython itself with address sanitizer, there is no need to use LD_PRELOAD or set PYTHONMALLOC, as long as the extension is built using the same ASAN runtime as CPython was.
An easy way to set that up in CI is to use the cpython_sanity docker images @nascheme as been working on:
https://github.com/nascheme/cpython_sanity
Here's an example of how NumPy uses the TSAN docker image in CI:
https://github.com/numpy/numpy/blob/d02611ad99488637b48f4be203f297ea7b29c95d/.github/workflows/compiler_sanitizers.yml#L74-L100
The CI image includes the compilers used to build CPython so it's usually straightforward to build extensions using the same compiler setup.
I still need to update NumPy's ASAN job to use the docker image instead of building python from-source in the CI job, but it should look more-or-less the same as the TSAN job.
Hi. That is a good tip. The reason it is only in the tox program but not on the CI is that I could only get it to work on my machine (tm). So I just run it as part of the release procedure to ensure there are no mistakes. I'd love to have it available in CI though. I will look at this when I have time or when somebody else makes a PR.