diff --git a/docs/debugging.md b/docs/debugging.md index 62c16a2..4f12fc7 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -316,6 +316,21 @@ PYTHON_GIL=0 python -c "import sys; print(sys._is_gil_enabled())" cd .. ``` +!!! note + On MacOS, you may see messages like this when you start Python: + + ``` + python(7027,0x1f6dfc240) malloc: nano zone abandoned due to inability to reserve vm space. + ``` + + This message is being emmitted by the MacOS malloc implementation. As + [explained + here](https://stackoverflow.com/questions/64126942/malloc-nano-zone-abandoned-due-to-inability-to-preallocate-reserved-vm-space), + this happens for any program compiled with thread sanitizer on MacOS and can + be safely ignored by setting the `MallocNanoZone` environment variable to + 0\. You should only set this in session you are running thread sanitizer + under, as this setting will slow down other programs that allocate memory. + ### Compile NumPy with TSAN - Get the source code (for example, the `main` branch) @@ -336,13 +351,7 @@ python -m pip install -U git+https://github.com/cython/cython - Build the package ```bash -export CC=clang-18 -export CXX=clang++-18 -export CFLAGS=-fsanitize=thread -export CXXFLAGS=-fsanitize=thread -export LDFLAGS=-fsanitize=thread - -python -m pip install -v . --no-build-isolation +CC=clang-18 CXX=clang++-18 python -m pip install -v . --no-build-isolation -Csetup-args=-Db_sanitize=thread ``` ### Useful TSAN options