[gst-devel] Re: memory leak in a program

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Tue Feb 7 23:38:01 CET 2006


It seems that it suffices that decodebin is in the PAUSE state to have
that leak. For example:

#include <gst/gst.h>

int
main (int argc, char *argv[])
{
  GstElement *pipeline;
  GstElement *filesrc;
  GstElement *decodebin;

  gst_init (&argc, &argv);

  pipeline = gst_pipeline_new ("pipeline");

  filesrc = gst_element_factory_make ("filesrc", "filesrc");
  g_assert (filesrc);
  g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);

  decodebin = gst_element_factory_make ("decodebin", "decodebin");
  g_assert (decodebin);

  gst_bin_add_many (GST_BIN (pipeline), filesrc, decodebin, NULL);
  gst_element_link (filesrc, decodebin);

  gst_element_set_state (pipeline, GST_STATE_PAUSED);

  gst_element_set_state (pipeline, GST_STATE_NULL);
  gst_object_unref (pipeline);

  gst_deinit ();

  return 1;
}


Vincent

On Tue, 7 Feb 2006, Vincent Torri wrote:

>
> hello, i'm writing a small program that print the informations of a media
> file to a terminal (named eic_cli)
>
> when I run valgrind on it, I get some memory leak :
>
> http://rafb.net/paste/results/yGuWx426.html
>
> the program can be downloaded here :
>
> http://www.iecn.u-nancy.fr/~torri/files/eic-0.1.tar.gz
>
> i don't know if the problem comes from my program or gstreamer (0.10, cvs,
> taken 2 days ago). When I quit the main function, I set the pipeline to
> the NULL state and I unref it (lines 380 and 381 of eic.c). I don't know
> if it's sufficient.
>
> Vincent Torri
>




More information about the gstreamer-devel mailing list