[libnice] Memory leaks

Miguel París Díaz mparisdiaz at gmail.com
Sat Apr 25 08:58:04 PDT 2015


Hello, I am not doing nice_agent_remove_stream(), it is needed in v0.1.10
even if the NiceAgent is released?
Moreover, using the same code with v0.1.7 there is not any memory leak
detected by valgrind.

2015-04-24 11:58 GMT+02:00 Philip Withnall <philip at tecnocode.co.uk>:

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


-- 
Miguel París Díaz
------------------------------------------------------------------------
Computer/Software engineer.
Researcher and architect in http://www.kurento.org
http://twitter.com/mparisdiaz
------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20150425/6b460104/attachment.html>


More information about the nice mailing list