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
- Reviewers
samsonov
Diff Detail
Event Timeline
Please add a test for this.
lib/sanitizer_common/sanitizer_flags.h | ||
---|---|---|
45 | ... if leak checking is disabled, or if ... |
LGTM
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 | Do you really need this printf here? |
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 | 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 | 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 | Ok, there are actually 2 separate issues here.
|
lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc | ||
---|---|---|
12 | 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 | Unfortunately it could cause the atexit handler to be installed late, and there would be discrepancy between standalone and ASan tools. |
Do you really need this printf here?