<div>Hi,</div>
<div> </div>
<div>I would like to run a pipeline several times in a program. The problem is that when a pipeline ends, and even if I free it with gst_object_unref, a part of the memory is not freed.</div>
<div>Above is the really simple code I use to test this memory leak problem.</div>
<div> </div>
<div>Thank you for your help,</div>
<div>Antoine Tarault</div>
<div> </div>
<div>
<p>#include <gst/gst.h></p>
<p>void gstMain()<br>{<br> GstClock *clock;<br> GstClockID clock_id;<br> GstClockReturn wait_ret;<br> GstElement *pipeline = NULL;<br> GstElement *video_src = NULL;<br> GstElement *video_sink = NULL;<br> gboolean res;</p>
<p> gst_init(NULL, NULL);</p>
<p><br> pipeline = gst_pipeline_new("avd_pipeline");</p>
<p> video_src = gst_element_factory_make("videotestsrc", "filesrc_avi");<br> if (video_src == NULL)<br> {<br> g_print("Error creating plugin type videotestsrc\n");<br> return;<br> }</p>
<p> video_sink = gst_element_factory_make("directdrawsink", "video_sink");<br> if (video_sink == NULL)<br> {<br> g_print("Error creating plugin type directdrawsink\n");<br> return;<br> }</p>
<p> gst_bin_add_many( GST_BIN(pipeline), <br> video_src,<br> video_sink,<br> NULL);</p>
<p> res = gst_element_link(video_src,video_sink);<br> if(!res)<br> {<br> g_print("error linking video src to video sink");<br> return;<br> }</p>
<p> clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline));<br> if(pipeline == NULL)<br> {<br> fprintf (stderr, "FREEING pipeline ...\n");<br> gst_object_unref(pipeline);<br> return;<br> }</p>
<p> clock_id =<br> gst_clock_new_single_shot_id (clock,<br> gst_clock_get_time (clock) + (7 * GST_SECOND));<br> gst_object_unref(clock);<br> <br> if (gst_element_set_state (pipeline, GST_STATE_PLAYING)) {<br> if ((wait_ret = gst_clock_id_wait (clock_id, NULL)) != GST_CLOCK_OK)
<br> {<br> GST_WARNING ("clock_id_wait returned: %d", wait_ret);<br> }<br> fprintf (stderr, "Setting pipeline to NULL ...\n");<br> gst_element_set_state(pipeline, GST_STATE_NULL);</p>
<p> fprintf (stderr, "FREEING pipeline ...\n");<br> gst_object_unref(pipeline);<br> }<br> return;<br>}</p>
<p><br>int main()<br>{<br> gstMain();<br> g_usleep(1000000);<br> gstMain();<br> return 0;<br>}<br></p></div>