Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add note about MacOS malloc warnings for tsan build #125

Merged
merged 6 commits into from
Jan 5, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
rgommers marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand All @@ -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 -C'setup-args=-Db_sanitize=thread
rgommers marked this conversation as resolved.
Show resolved Hide resolved
```

### Useful TSAN options
Expand Down