<div dir="ltr"><div class="gmail_extra">A few thoughts about this -- I'm not yet totally happy with a compile-time check here...</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 26, 2013 at 5:39 AM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":63x" style="overflow:hidden">Hi chandlerc, dblaikie,<br>
<br>
Disobey --disable-free flag if LEAK_SANITIZER macro is defined, for PR18320.<br>
This way the build for LeakSanitizer will need to use -DCMAKE_CXX_FLAGS=-DLEAK_SANITIZER<br>
<br>
Alternatives:<br>
1. use #if __has_feature(address_sanitizer). This will solve our immediate need<br>
to make asan+lsan bootstrap clean, but will not allow to run lsan-only (w/o asan).<br></div></blockquote><div><br></div><div>Yea, this doesn't make sense for me. Especially as lsan doesn't require any instrumentation at all.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":63x" style="overflow:hidden">
<br>
2. Check if we have lsan at run-time instead of build time.<br>
This may actually be nicer, but the only good way to do that that I know of<br>
is to use weak functions, which will require more ifdefs.<br></div></blockquote><div><br></div><div>I think this, or some variant of this, is probably the right strategy.</div><div><br></div><div>My suggestion would be a bit different. I would do something along the lines of making the allocations which --disable-free interacts with not appear to be "leaks" by placing their pointers into a global root somehow. I would rather be able to run LSan both with and without --disable-free and catch leaks either way.</div>
<div><br></div><div>Thoughts on that?</div><div><br></div><div>It seems like we could come up with a pointer-stashing strategy that would be well below the noise floor to avoid impacting performance?</div></div></div></div>