<div dir="ltr">On Thu, Jan 26, 2012 at 18:08, Yedidyah Bar-David <span dir="ltr"><<a href="mailto:linux-il@didi.bardavid.org">linux-il@didi.bardavid.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Thu, Jan 26, 2012 at 10:54:56AM -0500, Ori Berger wrote:<br>
> On 01/26/2012 10:16 AM, Baruch Siach wrote:<br>
><br>
> >>Only by using valgrind, that I could find the exact location and figure<br>
> >>out, that it was another function that had the problem.<br>
> >><br>
> >>How does the modern memory management system is working then, that it takes<br>
> >>so much time for the problem to surface ?<br>
> ><br>
> >Now, if you corrupt the internal glibc data structure, glibc won't notice<br>
> >until you try to call one of malloc(), free(), etc.<br>
><br>
> And in addition to what Baruch said:<br>
><br>
> Valgrind will always catch these errors, but will result in<br>
> significant slowdown (x10-x20). There are tools like DUMA (and its<br>
> earlier incarnation, Electric Fence) incur almost no CPU overhead<br>
> and can detect many kinds of corruptions as soon as they happen, by<br>
> using the memory management units.<br>
><br>
> (Because of the MMU granularity, you need to run your program twice<br>
> - one in which allocations are aligned to the lower address, and one<br>
> when they are aligned to the top address)<br>
><br>
> There is also a middle ground; gcc's mudflap<br>
> <<a href="http://www.stlinux.com/devel/debug/mudflap" target="_blank">http://www.stlinux.com/devel/debug/mudflap</a>> and -- if your program<br>
> is pure C and can be compiled by tcc,<br>
> <<a href="http://bellard.org/tcc/tcc-doc.html#SEC21" target="_blank">http://bellard.org/tcc/tcc-doc.html#SEC21</a>>; These are comparable to<br>
> valgrind in functionality (for code you compile with them; standard<br>
> library code runs at full speed/unchecked), but usually only<br>
> introduce a small slowdown (10% or so).<br>
<br>
</div></div>BTW, in case you do not know Fabric Bellard, he does lots of very cool<br>
stuff - he is the author of qemu, and every now and then I give a look<br>
at his site. I now did because of this post and found out an amazing<br>
project of a PC Emulator in Javascript:<br>
<a href="http://bellard.org/jslinux/" target="_blank">http://bellard.org/jslinux/</a><br>
The guy is simply amazing.<br>
<span class="HOEnZb"><font color="#888888">--<br>
Didi<br></font></span></blockquote><div><br>Thank you all, you made me wiser :)<br><br>Ido <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class="HOEnZb"><font color="#888888">
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
</div></div></blockquote></div><br></div>