-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Suppress leak checking on exit #719
Comments
Do you mean suppressing all leaks? If so, use LSAN_OPTIONS=detect_leaks=0. If you want to suppress only some particular leaks, use LSAN_OPTIONS=suppressions= interface. |
No, I do not want to suppress all leaks. I just want to suppress leaks of memory still reachable on exit. But, I still want to see leaks of memory that are not reachable anymore. |
Hm, LSan shouldn't report reachable memory blocks, it reports only not reachable ones. |
LSan reports reachable memory blocks on exit. ==17315==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1 byte(s) in 1 object(s) allocated from: SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s). |
Given that you don't use a, compiler might have removed it from main's stack... |
The program: Compiled using: still shows reachable leaks on exit. I have seen that if I call exit(0) reachable leaks are not reported anymore. |
It seems that a is out of scope when LSan performs analysis. Could you:
|
This is the new output: ==1554==ERROR: LeakSanitizer: detected memory leaks Direct leak of 1 byte(s) in 1 object(s) allocated from: SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s). for: |
I think when you call exit(), main's stack frame is still active so LSan can find reference to allocated block there whereas in alternative case the frame is already destroyed and so not considered. |
On Mon, Sep 5, 2016 at 12:57 PM, jmithmstr [email protected] wrote:
Try to manually execute __lsan_do_leak_check() at the point where you are |
OK, the code works as expected, and there is no need for any enhancement. Maybe the documentation could be improved to document this use case. |
WAI |
Maybe we still should consider to always suppress leak checks for exit()? My concern is that maybe some users already expect lsan even for exit() and if we change that we will brake them. |
yea, that sounds like breaking an existing useful functionality...
Do we understand how it happens? |
|
I am working on a software where the developers think that it is OK to not free memory still reacheable on exit. I am only interested in leaks while the program is running.
Is there a way to suppress leak checking on exit?
The text was updated successfully, but these errors were encountered: