<div dir="ltr">Yes, main contexts are freed<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-26 18:47 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"><p dir="ltr">Olivier is correct that you shouldn't need to remove the stream if the NiceAgent is finalised. However, the NiceAgent might not be finalised if you have the GMainContext problems I mentioned earlier. Have you verified that all your GMainContexts are freed before exiting?</p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">Philip</p></font></span><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Apr 25, 2015 6:09 PM, "Miguel París Díaz" <<a href="mailto:mparisdiaz@gmail.com" target="_blank">mparisdiaz@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I supposed it and agree with Olivier, so we can verify that there are memory leaks into libnice v01.10, isn't it?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-25 18:48 GMT+02:00 Olivier Crête <span dir="ltr"><<a href="mailto:olivier.crete@collabora.com" target="_blank">olivier.crete@collabora.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
<br>
On April 25, 2015 11:58:04 AM EDT, "Miguel París Díaz" <<a href="mailto:mparisdiaz@gmail.com" target="_blank">mparisdiaz@gmail.com</a>> wrote:<br>
>Hello, I am not doing nice_agent_remove_stream(), it is needed in<br>
>v0.1.10<br>
>even if the NiceAgent is released?<br>
>Moreover, using the same code with v0.1.7 there is not any memory leak<br>
>detected by valgrind.<br>
<br>
</span>It shouldn't be needed.<br>
<br>
Olivier<br>
<div><div><br>
<br>
>2015-04-24 11:58 GMT+02:00 Philip Withnall <<a href="mailto:philip@tecnocode.co.uk" target="_blank">philip@tecnocode.co.uk</a>>:<br>
><br>
>> Hey,<br>
>><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<br>
>for<br>
>> > libnice v0.1.10:<br>
>><br>
>> Thanks, that is a bit more useful. I have omitted all but the<br>
>relevant<br>
>> parts below.<br>
>><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>
>> > ==12303==    by 0xA6A8E1E: discovery_add_local_host_candidate<br>
>> > (discovery.c:563)<br>
>> > ==12303==    by 0xA69F7C2: nice_agent_gather_candidates<br>
>(agent.c:2737)<br>
>><br>
>> > ==12303== 528 (208 direct, 320 indirect) bytes in 2 blocks are<br>
>> > definitely lost in loss record 8,131 of 8,519<br>
>> *snip*<br>
>> > ==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<br>
>(agent.c:2737)<br>
>><br>
>> > nice_agent_add_stream<br>
>> > ==12303== 144 bytes in 2 blocks are possibly lost in loss record<br>
>7,624<br>
>> > of 8,519<br>
>> *snip*<br>
>> > ==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>
>> All of these traces look related, but I cannot fix them without<br>
>checking<br>
>> a few things first. I have fixed a number of leaks like this before,<br>
>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<br>
>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<br>
>are<br>
>> stopped or destroyed (and that they are actually destroyed).<br>
>><br>
>> > I cannot reproduce the memory leak that I reported some days ago<br>
>about<br>
>> > g_source_set_dummy_callback. But I have searched for it into<br>
>libnice<br>
>> > code, and I have found this entries:<br>
>><br>
>> This is related: that also is a GSource which is not getting freed<br>
>> somewhere.<br>
>><br>
>> Thanks,<br>
>> Philip<br>
>><br>
>> > 2015-04-15 13:08 GMT+02:00 Miguel París Díaz<br>
><<a href="mailto:mparisdiaz@gmail.com" target="_blank">mparisdiaz@gmail.com</a>>:<br>
>> >         Yes, you are right, sorry for not sending a complete<br>
>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" target="_blank">philip@tecnocode.co.uk</a>>:<br>
>> >                 Hi,<br>
>> ><br>
>> >                 On Mon, 2015-04-13 at 13:10 +0200, Miguel París<br>
>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<br>
>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<br>
>your<br>
>> >                 distribution for<br>
>> >                 libnice, or recompile it with debug symbols<br>
>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>
>><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>
>> ><br>
>> > --<br>
>> > Miguel París Díaz<br>
>> ><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>
--<br>
</div></div><span><font color="#888888">Olivier Crête<br>
<a href="mailto:olivier.crete@collabora.com" target="_blank">olivier.crete@collabora.com</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br><div><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>
</blockquote></div>
</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>