<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I'm getting this error when trying with the Valgrind suppresion file shipped with Erlang R16B:</div><div><br></div><div>[..]</div><div><div>--91449-- Scheduler: using generic scheduler lock implementation.</div><div>--91449-- Reading suppressions file: /opt/otp_src_R16B/erts/emulator/valgrind/suppress.patched.3.6.0</div><div>location should be "...", or should start with "fun:" or "obj:"</div><div>==91449== FATAL: in suppressions file "/opt/otp_src_R16B/erts/emulator/valgrind/suppress.patched.3.6.0" near line 95:</div><div>==91449== location should be "...", or should start with "fun:" or "obj:"</div><div>==91449== exiting now.</div></div><div><br></div><div><br></div><div><div>Regards,</div><div>Zabrane</div></div><div><br><div><div>On Mar 18, 2013, at 4:45 PM, Lukas Larsson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>Hello,<br><br>use the suppress file in erts/emulator/valgrind/suppress.standard to remove many of the false positive errors. It will not remove all, but many of the extra errors you see. To remove all you have to use erts/emulator/valgrind/suppress.patched.3.6.0, but this requires a patched version of valgrind as the normal suppression syntax was not expressive enough for our needs.<br>
<br></div>Lukas<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 17, 2013 at 10:35 AM, Zabrane Mickael <span dir="ltr"><<a href="mailto:zabrane3@gmail.com" target="_blank">zabrane3@gmail.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 guys,</div><div><br></div><div>I'm trying to use Valgrind to track memory leaks in C NIF/Linkedin drivers.</div>
<div>For this, I've built a "Debug Enabled" ERTS with Valgrind and SMP flavor:</div><div><a href="http://www.erlang.org/doc/installation_guide/INSTALL.html" target="_blank">http://www.erlang.org/doc/installation_guide/INSTALL.html</a></div>
<div><br></div><div>1/ First attempt: start an Erlang node and turn it off immediately:</div><div><br></div><div>$ cerl -valgrind</div><div>[...]</div><div><br></div><div>1> init:stop().</div><div><br></div><div>[...]</div>
<div><div><div>==61127== at 0xC713: malloc (vg_replace_malloc.c:274)</div><div>==61127== by 0x1002C25F0: erts_sys_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==61127== by 0x10000B6B3: erts_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==61127== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==61127== by 0x1001053E7: init_db (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==61127== by 0x10002884B: erl_init (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==61127== by 0x10002D273: erl_start (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==61127== by 0x10000191F: main (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==61127== </div><div>==61127== ERROR SUMMARY: 420 errors from 13 contexts (suppressed: 0 from 0)</div></div>
</div><div><br></div><div>420 errors reported.</div><div><br></div><div>Rickard Green explained why Valgrind reported these (false) numbers at:</div><div><a href="http://erlang.org/pipermail/erlang-questions/2010-February/049591.html" target="_blank">http://erlang.org/pipermail/erlang-questions/2010-February/049591.html</a></div>
<div><br></div><div><div><br></div><div>2/ Second attempt: simply load "crypto" module and stop it:</div></div><div><br></div><div>$ cerl -valgrind</div><div>[...]</div><div><br></div><div>1> crypto:start().</div>
<div>2> crypto:stop(). </div><div>ok</div><div>3> </div><div>=INFO REPORT==== 17-Mar-2013::10:18:26 ===</div><div> application: crypto</div><div> exited: stopped</div><div> type: temporar</div><div>4> init:stop().</div>
<div><br></div><div>[...]</div><div><div>==59400== at 0xC713: malloc (vg_replace_malloc.c:274)</div><div>==59400== by 0x1002C25F0: erts_sys_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==59400== by 0x10000B6B3: erts_alloc (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==59400== by 0x10000B5AC: erts_alloc_permanent_cache_aligned (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==59400== by 0x1001053E7: init_db (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==59400== by 0x10002884B: erl_init (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==59400== by 0x10002D273: erl_start (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div><div>==59400== by 0x10000191F: main (in /opt/r16b/usr/lib/erlang/erts-5.10.1/bin/beam.valgrind.smp)</div>
<div>==59400== </div><div>==59400== ERROR SUMMARY: 460 errors from 15 contexts (suppressed: 0 from 0)</div></div><div><br></div><div>Valgrind now reorts 460 errors instead of 420 (see above).</div><div><br></div><div>I know, there's no memory leak in "crypto" ... but this doesn't help at all. Completely useless.</div>
<div><br></div><div>So, my question is very simple: </div><div>How Valgrind can help me to track memory leaks in my own NIF/linked-in drivers then?</div><div>How can I distinguish between these falsy reported numbers and the real ones?</div>
<div><br></div><div>Finally, is there any other way than Valgrind?</div><div><br></div><div>
<div style="word-wrap:break-word"><div style="word-wrap:break-word"><div>Regards,</div><div>Zabrane</div><div><br></div></div></div><br>
</div>
<br></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>
</blockquote></div><div apple-content-edited="true"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><br></div></div></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>