<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 10, 2015 at 4:40 PM, Anna Zaks <span dir="ltr"><<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hi,</div><div><br></div>There seems to be a discrepancy between what the default value of 'allocator_may_return_null' should be:<div>  source code:<br><div><div style="margin:0px;font-family:Menlo">  ./lib/sanitizer_common/sanitizer_flags.inc:COMMON_FLAG(bool, allocator_may_return_null, false,</div></div><div style="margin:0px;font-family:Menlo"><br></div><div style="margin:0px"><font face="Menlo"> </font>docs (<a href="https://code.google.com/p/address-sanitizer/wiki/Flags" target="_blank">https://code.google.com/p/address-sanitizer/wiki/Flags</a>)<span style="font-family:Menlo">:</span></div><div style="margin:0px"><table style="font-family:arial,sans-serif;border-spacing:0px;border:1px solid rgb(204,204,204);color:rgb(0,0,0);font-size:13px;background-color:rgb(255,255,255)"><tbody><tr><td style="border:1px solid rgb(204,204,204);padding:5px">allocator_may_return_null </td><td style="border:1px solid rgb(204,204,204);padding:5px">1 </td><td style="border:1px solid rgb(204,204,204);padding:5px">If false, the allocator will crash instead of returning 0 on out-of-memory.</td></tr></tbody></table><div style="font-family:Menlo"><br></div><div></div></div></div></div></blockquote><div><br></div><div>Good catch, fixed the wiki. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div style="margin:0px"><div>I suspect that the reason to have <font face="arial, sans-serif" size="4"><span style="background-color:rgb(255,255,255)">it default to 'false' is because that would provide for a </span>more predictable out of memory behavior in most use cases. </font></div></div></div></div></blockquote><div><br></div><div>Correct. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div style="margin:0px"><div><font face="arial, sans-serif" size="4">Is that the case or should this be system dependent and match the default system allocator?</font></div></div></div></div></blockquote><div><br></div><div>Errr.. I don't think so. </div><div>asan's allocator is very different from "a system allocator" in many other ways.</div><div>E.g. it consumes more memory, and so a program that runs normally w/ a system allocator will OOM with asan. </div><div>It's better to have asan crash instantly on OOM rather than returning 0. </div><div>The user is then notified about the flag. </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div style="margin:0px"><div><font face="arial, sans-serif" size="4"><br></font></div><div><font face="arial, sans-serif" size="4">Thanks,</font></div><div><font face="arial, sans-serif" size="4">Anna.</font></div></div></div></div></blockquote></div><br></div></div>