We needed a way to tell LSan to invoke leak checking only if __do_leak_check() is called explicitly.
This can now be achieved by setting leak_check_at_exit=false.
Details
Details
- Reviewers
samsonov
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Please add a test for this.
lib/sanitizer_common/sanitizer_flags.h | ||
---|---|---|
45 | ... if leak checking is disabled, or if ... |
Comment Actions
LGTM
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 ↗ | (On Diff #3130) | Do you really need this printf here? |
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 ↗ | (On Diff #3130) | Somehow atexit handlers are not invoked if main is a no-op. I didn't investigate further. |
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 ↗ | (On Diff #3130) | That is, LSan wouldn't run leak checking if main() is empty? I think it's |
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 ↗ | (On Diff #3130) | Ok, there are actually 2 separate issues here.
|
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 ↗ | (On Diff #3130) | Ah, I see. I won't bother with (2), as I assume LSan will surely initialize itself as soon as the first malloc() is called, so I don't think there's any reason in explicitly calling Init() somehow. |
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 ↗ | (On Diff #3130) | Unfortunately it could cause the atexit handler to be installed late, and there would be discrepancy between standalone and ASan tools. |
... if leak checking is disabled, or if ...