Gstreamer & GLib memory management/profiling
Sebastian Dröge
sebastian at centricular.com
Fri Oct 31 14:53:15 PDT 2014
On Fr, 2014-10-31 at 22:37 +0100, Sergei Vorobyov wrote:
> So it's useless for programs that run forever. Besides, it's obvious that
> the memory leaks problem is algorithmically unsolvable, in principle. E.g.,
> if you stop your program and it reports "leak", you can never be sure, it
> may be freed some time later; you can never dis/prove if a memory block is
> saved, say in a list, or lost/leaked, etc, etc).
>
> Consequently, Valgrind is a "mission impossible" project, no mater how you
> like it.
valgrind is only reporting memory as leaked/lost that was allocated but
is not referenced anymore from any place. So if you keep a pointer to
the memory around somewhere it is considered still reachable and not
leaked. Check the valgrind docs.
Of course valgrind is not perfect (it's not solving the halting problem
for you), but it will find leaked memory quite reliable (or invalid
memory accesses, double frees, etc)... and the other tools included in
valgrind are also quite useful. E.g. with massif you can find places in
your program where memory is accumulating for some reason but is not
leaked, like your example of just storing all allocated memory in some
list that forever grows.
It's a useful tool to have next to a debugger and compiler.
--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141031/852b4533/attachment.sig>
More information about the gstreamer-devel
mailing list