[libnice] Memory leaks
Miguel París Díaz
mparisdiaz at gmail.com
Thu May 14 04:13:33 PDT 2015
Hello everybody,
I am adding Jose.
2015-05-02 0:20 GMT+02:00 Philip Withnall <philip at tecnocode.co.uk>:
> Can you please verify that by:
> 1. Running your test program under gdb, breaking on
> g_main_context_unref, and checking that it is actually freed.
> 2. Separately, running your test program with gobject-list[1] or the
> environment variable GOBJECT_DEBUG=objects,instance-count set, and
> seeing what objects are left over on exit.
>
> Sorry I’m asking for so much information, but leaks like this in libnice
> depend on a lot of control flow which I have very little chance of
> replicating.
>
> Thanks,
> Philip
>
> [1]: https://github.com/danni/gobject-list
>
> On Tue, 2015-04-28 at 10:24 +0200, Miguel París Díaz wrote:
> > Yes, main contexts are freed
> >
> >
> > 2015-04-26 18:47 GMT+02:00 Philip Withnall <philip at tecnocode.co.uk>:
> > 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?
> >
> > Philip
> >
> > On Apr 25, 2015 6:09 PM, "Miguel París Díaz"
> > <mparisdiaz at gmail.com> wrote:
> > I supposed it and agree with Olivier, so we can verify
> > that there are memory leaks into libnice v01.10, isn't
> > it?
> >
> >
> > 2015-04-25 18:48 GMT+02:00 Olivier Crête
> > <olivier.crete at collabora.com>:
> >
> >
> > On April 25, 2015 11:58:04 AM EDT, "Miguel
> > París Díaz" <mparisdiaz at gmail.com> wrote:
> > >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.
> >
> > It shouldn't be needed.
> >
> > Olivier
> >
> >
> > >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
> > >> >
> >
> >------------------------------------------------------------------------
> > >> >
> > >>
> > >>
> >
> > --
> >
> > Olivier Crête
> > olivier.crete at collabora.com
> >
> >
> >
> > --
> > 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/20150514/81a17387/attachment-0001.html>
More information about the nice
mailing list