Enable LeakSanitizer (LSan) via -DSANITIZE=ON on Linux; add sanitized CI jobs#411
Merged
Enable LeakSanitizer (LSan) via -DSANITIZE=ON on Linux; add sanitized CI jobs#411
Conversation
… CI jobs - Add -fsanitize=leak to the Debug sanitizer flags, guarded by NOT APPLE (Apple's LLVM drops standalone LSan; on Linux it is included with ASan) - Add build-and-test-sanitized CircleCI job (Clang, Linux) that runs with SANITIZE=ON on every PR, replacing Valgrind as the leak-detection path - Enable SANITIZE=ON in the macOS CI job for ASan/UBSan coverage Fixes #365 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adding -fsanitize=leak alongside -fsanitize=address links two LSan runtimes which conflict at startup and cause crashes. ASan on Linux x86_64/aarch64 already enables LSan by default (detect_leaks=1). https://clang.llvm.org/docs/LeakSanitizer.html
Ubuntu 22.04 raised mmap_rnd_bits to 28, which conflicts with ASan's fixed shadow memory offsets and causes random startup crashes across different test binaries between runs. google/sanitizers#1716
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #411 +/- ##
=======================================
Coverage 99.59% 99.59%
=======================================
Files 20 20
Lines 1737 1737
=======================================
Hits 1730 1730
Misses 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #365
Summary
-fsanitize=leakto the Debug sanitizer flags inCMakeLists.txt, guarded byNOT APPLE— Apple's LLVM drops standalone LSan support entirely; on Linux it is automatically included alongside ASanbuild-and-test-sanitizedCircleCI job (Clang, Linux) that builds withSANITIZE=ONon every PR, giving continuous leak detection without ValgrindSANITIZE=ONin the existing macOS CI job for ASan + UBSan coverage (no LSan there, but catches memory errors and undefined behavior)Test plan
m4pro): build succeeds withSANITIZE=ON, no-fsanitize=leakflag applied, all 28 tests passflags.makeinspection)🤖 Generated with Claude Code