<div dir="ltr"><div>Hello, I am not doing nice_agent_remove_stream(), it is needed in v0.1.10 even if the NiceAgent is released?<br></div>Moreover, using the same code with v0.1.7 there is not any memory leak detected by valgrind.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-24 11:58 GMT+02:00 Philip Withnall <span dir="ltr"><<a href="mailto:philip@tecnocode.co.uk" target="_blank">philip@tecnocode.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey,<br>
<span class=""><br>
On Tue, 2015-04-21 at 19:15 +0200, Miguel París Díaz wrote:<br>
> Hello again,<br>
><br>
> I have run valgrind again with debug symbol and this is the output for<br>
> libnice v0.1.10:<br>
<br>
</span>Thanks, that is a bit more useful. I have omitted all but the relevant<br>
parts below.<br>
<span class=""><br>
> nice_agent_gather_candidates<br>
> ==12303== 688 (80 direct, 608 indirect) bytes in 2 blocks are<br>
> definitely lost in loss record 8,233 of 8,519<br>
</span>> ==12303==    by 0xA6A8E1E: discovery_add_local_host_candidate<br>
<span class="">> (discovery.c:563)<br>
> ==12303==    by 0xA69F7C2: nice_agent_gather_candidates (agent.c:2737)<br>
<br>
</span><span class="">> ==12303== 528 (208 direct, 320 indirect) bytes in 2 blocks are<br>
> definitely lost in loss record 8,131 of 8,519<br>
</span>*snip*<br>
<span class="">> ==12303==    by 0xA6B26F1: nice_tcp_active_socket_new<br>
> (tcp-active.c:106)<br>
> ==12303==    by 0xA6A8DFE: discovery_add_local_host_candidate<br>
> (discovery.c:561)<br>
> ==12303==    by 0xA69F7C2: nice_agent_gather_candidates (agent.c:2737)<br>
<br>
</span><span class="">> nice_agent_add_stream<br>
> ==12303== 144 bytes in 2 blocks are possibly lost in loss record 7,624<br>
> of 8,519<br>
</span>*snip*<br>
<span class="">> ==12303==    by 0x792F40B: g_cancellable_source_new<br>
> (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1)<br>
> ==12303==    by 0xA697CB1: component_new (component.c:150)<br>
> ==12303==    by 0xA6A1EDF: stream_new (stream.c:68)<br>
> ==12303==    by 0xA69B49F: nice_agent_add_stream (agent.c:2361)<br>
> ==12303==    by 0xA27F6B5: kms_webrtc_base_connection_configure<br>
> (kmswebrtcbaseconnection.c:35)<br>
<br>
</span>All of these traces look related, but I cannot fix them without checking<br>
a few things first. I have fixed a number of leaks like this before, and<br>
typically the problem is actually that the GMainContext still has<br>
pending events when it is stopped. This means one or more GSources are<br>
kept alive. In libnice, this generally means an associated GSocket is<br>
also kept alive, which is what is leaking above.<br>
<br>
Are you absolutely sure that:<br>
 • your test code is not leaking a NiceAgent;<br>
 • your test code is not leaking a stream (use<br>
nice_agent_remove_stream()); and<br>
 • there are no pending events left in your GMainContexts when they are<br>
stopped or destroyed (and that they are actually destroyed).<br>
<span class=""><br>
> I cannot reproduce the memory leak that I reported some days ago about<br>
> g_source_set_dummy_callback. But I have searched for it into libnice<br>
> code, and I have found this entries:<br>
<br>
</span>This is related: that also is a GSource which is not getting freed<br>
somewhere.<br>
<br>
Thanks,<br>
Philip<br>
<div class="HOEnZb"><div class="h5"><br>
> 2015-04-15 13:08 GMT+02:00 Miguel París Díaz <<a href="mailto:mparisdiaz@gmail.com">mparisdiaz@gmail.com</a>>:<br>
>         Yes, you are right, sorry for not sending a complete report.<br>
><br>
>         I will do it when I can and send the report again ;).<br>
><br>
><br>
>         2015-04-13 16:32 GMT+02:00 Philip Withnall<br>
>         <<a href="mailto:philip@tecnocode.co.uk">philip@tecnocode.co.uk</a>>:<br>
>                 Hi,<br>
><br>
>                 On Mon, 2015-04-13 at 13:10 +0200, Miguel París Díaz<br>
>                 wrote:<br>
>                 > Hello,<br>
>                 ><br>
>                 > I have tested my system with valgrind and I have<br>
>                 seen some memory<br>
>                 > leaks into libnice v0.1.10.<br>
>                 > Valgind does not detect any memory leak running the<br>
>                 same tests with<br>
>                 > v0.1.7.<br>
>                 ><br>
>                 > I hope this can help you to fix them ;).<br>
><br>
>                 Not really, without the necessary debug symbols<br>
>                 (replacing the ‘???’<br>
>                 entries in the stack traces below).<br>
><br>
>                 Can you please install the debug info package for your<br>
>                 distribution for<br>
>                 libnice, or recompile it with debug symbols enabled;<br>
>                 then produce a new<br>
>                 set of leak traces with valgrind?<br>
><br>
>                 Thanks,<br>
>                 Philip<br>
><br>
><br>
><br>
><br>
><br>
>         --<br>
>         Miguel París Díaz<br>
>         ------------------------------------------------------------------------<br>
>         Computer/Software engineer.<br>
>         Researcher and architect in <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br>
>         <a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>
>         ------------------------------------------------------------------------<br>
><br>
><br>
><br>
><br>
> --<br>
> Miguel París Díaz<br>
> ------------------------------------------------------------------------<br>
> Computer/Software engineer.<br>
> Researcher and architect in <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br>
> <a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>
> ------------------------------------------------------------------------<br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Miguel París Díaz<br>------------------------------------------------------------------------<br>Computer/Software engineer.<br>Researcher and architect in <a href="http://www.kurento.org" target="_blank">http://www.kurento.org</a><br><a href="http://twitter.com/mparisdiaz" target="_blank">http://twitter.com/mparisdiaz</a><br>------------------------------------------------------------------------<br></div></div>
</div>