Skip to content

Commit 4df854e

Browse files
[lldb][lit] Add MallocNanoZone envvar to Darwin ASan builds (#88431)
When builds on Darwin are configured with ASan, running tests will emit a warning about malloc's nano zone (`malloc: nano zone abandoned due to inability to reserve vm space`) that can interfere with the test output and cause failures. Setting the environment variable `MallocNanoZone` to 0 will remove this warning and allow the tests to run as normal.
1 parent 08e210c commit 4df854e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lldb/test/API/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def delete_module_cache(path):
121121
config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime(
122122
"libclang_rt.asan_osx_dynamic.dylib"
123123
)
124+
config.environment["MallocNanoZone"] = "0"
124125

125126
if "Thread" in config.llvm_use_sanitizer:
126127
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"

lldb/test/Shell/lit.cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
# Enable sanitizer runtime flags.
5353
config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1"
5454
config.environment["TSAN_OPTIONS"] = "halt_on_error=1"
55+
if "Darwin" in config.host_os:
56+
config.environment["MallocNanoZone"] = "0"
5557

5658
# Support running the test suite under the lldb-repro wrapper. This makes it
5759
# possible to capture a test suite run and then rerun all the test from the

0 commit comments

Comments
 (0)