Gstreamer Memory Tracing using mtrace
Tim-Philipp Müller
t.i.m at zen.co.uk
Tue Jul 23 06:37:27 PDT 2013
On Tue, 2013-07-23 at 07:54 -0500, Randall Scheifele wrote:
Hi,
> Thanks for the clarification. Are the one-time allocations you
> referred to all done inside the gst_init call? I could move the
> mtrace function call to after the gst_init and muntrace before the
> gst_deinit. However, if these one time allocations happen all over
> the place I might be out of luck.
Many should happen from inside gst_init(), but there are some cases
where they may happen later as well (e.g. GLib may just leak a small
chunk of memory if the global quark list expands, or GObject type
registrations that happen later when plugins get loaded).
So it's not going to be easy if you can't keep track where the various
allocations have been made from (so you can see if they are e.g. GObject
related or something else).
Cheers
-Tim
> On Tue, Jul 23, 2013 at 7:47 AM, Tim-Philipp Müller <t.i.m at zen.co.uk>
> wrote:
> On Tue, 2013-07-23 at 07:33 -0500, Randall Scheifele wrote:
>
> Hi,
>
> > Has anyone attempted to use mtrace with gstreamer? Even
> with the
> > simplest gstreamer program I get tons of memory not free'd
> errors.
> >
> >
> > For example, here is my simple program:
> >
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <gst/gst.h>
> > #include <mcheck.h>
> >
> >
> > int main(int argc, char* argv[])
> > {
> > // Start memory tracing
> > mtrace();
> >
> > // Initialize gstreamer
> > gst_init(&argc, &argv);
> >
> >
> > // Cleanup gstreamer
> > gst_deinit();
> >
> >
> > // Stop memory tracing
> > muntrace();
> >
> >
> > return 0;
> > }
> >
> >
> > When I run this on my ubuntu 10.04 machine running gstreamer
> 0.10.28,
> > I get the following output from mtrace. I realize that
> 0.10.28 is an
> > outdated version, but is my test valid? Is there any way I
> can get
> > mtrace to say no memory leaked?
> >
> >
> > I am actually running gstreamer 0.10.32 on an embedded
> system and am
> > just playing with mtrace on the host to try and get to a
> point where I
> > don't get any memory errors. If I can't get the list down I
> won't be
> > able to determine which errors are always there versus the
> ones I'm
> > interested in fixing in my application or plugins. I've
> heard good
> > things about valgrind, but it is not ported for my target
> > architecture.
>
>
> Both GStreamer and GLib/GObject will do a number of one-time
> allocations, which will may never be cleaned up, so it's kind
> of
> expected that you still see allocated memory at the end.
>
> Cheers
> -Tim
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list