Page MenuHomePhabricator

[lsan] Add an interface function for on-demand leak checking.
ClosedPublic

Authored by earthdok on Apr 21 2015, 10:14 AM.

Details

Summary

Add an interface function which can be used to periodically trigger
leak detection in a long-running process.

NB: The meaning of the kIgnored tag has been changed to allow easy clean-up
between subsequent leak checks. Previously, this tag was applied to explicitly
ignored (i.e. with lsan_disable() or lsan_ignore_object()) chunks *and* any
chunks only reachable from those. With this change, it's only applied to
explicitly ignored chunks.

Diff Detail

Repository
rL LLVM

Event Timeline

earthdok updated this revision to Diff 24143.Apr 21 2015, 10:14 AM
earthdok retitled this revision from to [lsan] Add an interface function for on-demand leak checking..
earthdok updated this object.
earthdok edited the test plan for this revision. (Show Details)
earthdok added a reviewer: samsonov.
earthdok added a subscriber: Unknown Object (MLST).

As always, I hate the name, so any suggestions are welcome.

Incidentally this will call the summary callback every time leaks are detected. Do you foresee any problems with that?

Our symbolization code still leaks. :( When I call this function in an infinite loop I observe a small but steady increase in memory usage (as shown by smem) - but only when symbolization is enabled.

samsonov accepted this revision.Apr 21 2015, 12:50 PM
samsonov edited edge metadata.

LGTM!

I think that printing SUMMARY multiple times is fine. We do this in both TSan and (recoverable) UBSan, for instance. Leaking symbolization is an issue... Let me know if you want to investigate it, or delegate it to me.

include/sanitizer/lsan_interface.h
61 ↗(On Diff #24143)

Bikeshedding suggestion from me:

__lsan_do_recoverable_leak_check()
lib/lsan/lsan_common.cc
333 ↗(On Diff #24143)

Add

void(arg)

to defeat unused-variable warning?

443 ↗(On Diff #24143)
if (!have_leaks)
  return;
<more code>
This revision is now accepted and ready to land.Apr 21 2015, 12:50 PM

Leaking symbolization is an issue... Let me know if you want to investigate it, or delegate it to me.

Fixed in r235411

include/sanitizer/lsan_interface.h
61 ↗(On Diff #24143)

I'll have to give this another thought before landing.

lib/lsan/lsan_common.cc
333 ↗(On Diff #24143)

done

443 ↗(On Diff #24143)

done

earthdok updated this revision to Diff 24166.Apr 21 2015, 1:13 PM
earthdok edited edge metadata.
  • address comments

OK, feel free to land when it's convenient for you.

earthdok updated this revision to Diff 24391.Apr 24 2015, 9:50 AM
  • change "extra" to "recoverable"
This revision was automatically updated to reflect the committed changes.

Committed r235728