<div>Hi,</div>
<div> I am trying to run multiple pipelines simultaneously to play media. The goal is to have simultaneous playbacks. And for every new playback requested from my application I instantiate a new pipeline and once done free up the pipeline (every pipeline runs in its own g_main_loop). This whole thing works but for now instead for actual playback I am storing the streams.
</div>
<div>One of the problems I am facing is that if I run multiple sessions simultaneously then I can see the memory consumption going up and then not getting freed up ( I am watching this with top). But this does not happen If I run my sessions in a serial fashion (I mean one after other). Note that I am creating a new pipeline for every session.
</div>
<div>I ran this through valgrind and found some big memory leaks</div>
<div> </div>
<div>==00:00:02:05.878 30282== 96,554 (4,644 direct, 91,910 indirect) bytes in 387 blocks are definitely lost in loss record 8,722 of 8,741<br>==00:00:02:05.878 30282== at 0x40054E5: malloc (vg_replace_malloc.c:149)<br>
==00:00:02:05.878 30282== by 0x20DA55: g_malloc (in /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x21D7B7: g_slice_alloc (in /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x1E86CA: g_ptr_array_sized_new (in /lib/libglib-
2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x1E8711: g_ptr_array_new (in /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x6FE3476: gst_static_caps_get (gstcaps.c:460)<br>==00:00:02:05.879 30282== by 0x44E2BC0: close_pad_link (
gstdecodebin.c:525)<br>==00:00:02:05.879 30282== by 0x44E3D8C: type_found (gstdecodebin.c:1559)<br>==00:00:02:05.879 30282== by 0x70333CC: gst_marshal_VOID__UINT_BOXED (gstmarshal.c:507)<br>==00:00:02:05.879 30282== by 0x3BCD9A: g_closure_invoke (in /lib/libgobject-
2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x3CD432: (within /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x3CE956: g_signal_emit_valist (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:
05.879 30282== by 0x3CEB18: g_signal_emit (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.879 30282== by 0x4831D1A: gst_type_find_element_activate (gsttypefindelement.c:743)<br>==00:00:02:05.879 30282== by 0x700622B: gst_pad_set_active (
gstpad.c:648)<br>==00:00:02:05.879 30282== by 0x6FED94A: activate_pads (gstelement.c:2446)<br>==00:00:02:05.879 30282== by 0x6FF9886: gst_iterator_fold (gstiterator.c:503)<br>==00:00:02:05.879 30282== by 0x6FED3C1: iterator_activate_fold_with_resync (
gstelement.c:2478)<br>==00:00:02:05.879 30282== by 0x6FED487: gst_element_pads_activate (gstelement.c:2521)<br>==00:00:02:05.879 30282== by 0x6FED7F5: gst_element_change_state_func (gstelement.c:2586)<br>==00:00:02:
05.879 30282== by 0x4832149: gst_type_find_element_change_state (gsttypefindelement.c:770)<br>==00:00:02:05.879 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.879 30282== by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)<br>==00:00:02:05.879 30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.879 30282== by 0x6FDD494: gst_bin_change_state_func (gstbin.c:1953)<br>==00:00:02:05.879 30282== by 0x44E4D7E: gst_decode_bin_change_state (
gstdecodebin.c:1694)<br>==00:00:02:05.879 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.879 30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.879
30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.879 30282== by 0x6FDD494: gst_bin_change_state_func (gstbin.c:1953)<br>==00:00:02:05.879 30282== by 0x7008C96: gst_pipeline_change_state (
gstpipeline.c:503)<br>==00:00:02:05.879 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.879 30282== by 0x6FE9DA0: gst_element_continue_state (gstelement.c:2077)<br>==00:00:02:05.879
30282== by 0x6FEA175: gst_element_change_state (gstelement.c:2399)<br>==00:00:02:05.879 30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.879 30282== by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)<br>==00:00:02:05.879 30282== by 0x80B53F0: Session::play() (session.cpp:1044)<br>==00:00:02:05.879 30282== by 0x80B5570: Session::svc() (session.cpp:1065)<br>==00:00:02:05.879 30282== by 0x410D6E5: ACE_Task_Base::svc_run(void*) (
Task.cpp:254)<br>==00:00:02:05.879 30282== by 0x410E257: ACE_Thread_Adapter::invoke_i() (Thread_Adapter.cpp:151)<br>==00:00:02:05.879 30282==<br> </div>
<div> </div>
<div>==00:00:02:05.899 30282== 35,136 bytes in 283 blocks are indirectly lost in loss record 8,740 of 8,741<br>==00:00:02:05.899 30282== at 0x40055E2: realloc (vg_replace_malloc.c:306)<br>==00:00:02:05.899 30282== by 0x20D91A: g_realloc (in /lib/libglib-
2.0.so.0.1200.11)<br>==00:00:02:05.899 30282== by 0x1E877F: (within /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.899 30282== by 0x1E8F28: g_array_append_vals (in /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.899
30282== by 0x7012D9C: gst_structure_set_field (gststructure.c:593)<br>==00:00:02:05.899 30282== by 0x7015175: gst_structure_from_string (gststructure.c:1848)<br>==00:00:02:05.899 30282== by 0x6FE2F40: gst_caps_from_string_inplace (
gstcaps.c:1821)<br>==00:00:02:05.899 30282== by 0x6FE349D: gst_static_caps_get (gstcaps.c:467)<br>==00:00:02:05.899 30282== by 0x44E2BC0: close_pad_link (gstdecodebin.c:525)<br>==00:00:02:05.899 30282== by 0x44E3D8C: type_found (
gstdecodebin.c:1559)<br>==00:00:02:05.899 30282== by 0x70333CC: gst_marshal_VOID__UINT_BOXED (gstmarshal.c:507)<br>==00:00:02:05.899 30282== by 0x3BCD9A: g_closure_invoke (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:
05.899 30282== by 0x3CD432: (within /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.899 30282== by 0x3CE956: g_signal_emit_valist (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.899 30282== by 0x3CEB18: g_signal_emit (in /lib/libgobject-
2.0.so.0.1200.11)<br>==00:00:02:05.899 30282== by 0x4831D1A: gst_type_find_element_activate (gsttypefindelement.c:743)<br>==00:00:02:05.899 30282== by 0x700622B: gst_pad_set_active (gstpad.c:648)<br>==00:00:02:05.899
30282== by 0x6FED94A: activate_pads (gstelement.c:2446)<br>==00:00:02:05.899 30282== by 0x6FF9886: gst_iterator_fold (gstiterator.c:503)<br>==00:00:02:05.899 30282== by 0x6FED3C1: iterator_activate_fold_with_resync (
gstelement.c:2478)<br>==00:00:02:05.899 30282== by 0x6FED487: gst_element_pads_activate (gstelement.c:2521)<br>==00:00:02:05.899 30282== by 0x6FED7F5: gst_element_change_state_func (gstelement.c:2586)<br>==00:00:02:
05.899 30282== by 0x4832149: gst_type_find_element_change_state (gsttypefindelement.c:770)<br>==00:00:02:05.899 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.899 30282== by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)<br>==00:00:02:05.899 30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.899 30282== by 0x6FDD494: gst_bin_change_state_func (gstbin.c:1953)<br>==00:00:02:05.899 30282== by 0x44E4D7E: gst_decode_bin_change_state (
gstdecodebin.c:1694)<br>==00:00:02:05.899 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.899 30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.899
30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.899 30282== by 0x6FDD494: gst_bin_change_state_func (gstbin.c:1953)<br>==00:00:02:05.899 30282== by 0x7008C96: gst_pipeline_change_state (
gstpipeline.c:503)<br>==00:00:02:05.899 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.899 30282== by 0x6FE9DA0: gst_element_continue_state (gstelement.c:2077)<br>==00:00:02:05.899
30282== by 0x6FEA175: gst_element_change_state (gstelement.c:2399)<br>==00:00:02:05.899 30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.899 30282== by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)<br>==00:00:02:05.899 30282== by 0x80B53F0: DCAAdapterConn::transcode() (dca_adapter_conn.cpp:1044)<br>==00:00:02:05.899 30282== by 0x80B5570: DCAAdapterConn::svc() (dca_adapter_conn.cpp:1065)<br>==00:00:02:
05.900 30282==<br> </div>
<div> </div>
<div>==00:00:02:05.897 30282== 24,704 bytes in 386 blocks are indirectly lost in loss record 8,738 of 8,741<br>==00:00:02:05.897 30282== at 0x40054E5: malloc (vg_replace_malloc.c:149)<br>==00:00:02:05.897 30282== by 0x400556F: realloc (vg_replace_malloc.c:306)
<br>==00:00:02:05.897 30282== by 0x20D91A: g_realloc (in /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.897 30282== by 0x1E81D7: (within /lib/libglib-2.0.so.0.1200.11)<br>==00:00:02:05.897 30282== by 0x1E8239: g_ptr_array_add (in /lib/libglib-
2.0.so.0.1200.11)<br>==00:00:02:05.897 30282== by 0x6FE2E85: gst_caps_append_structure (gstcaps.c:696)<br>==00:00:02:05.897 30282== by 0x6FE2F57: gst_caps_from_string_inplace (gstcaps.c:1825)<br>==00:00:02:05.897 30282== by 0x6FE349D: gst_static_caps_get (
gstcaps.c:467)<br>==00:00:02:05.897 30282== by 0x44E2BC0: close_pad_link (gstdecodebin.c:525)<br>==00:00:02:05.897 30282== by 0x44E3D8C: type_found (gstdecodebin.c:1559)<br>==00:00:02:05.897 30282== by 0x70333CC: gst_marshal_VOID__UINT_BOXED (
gstmarshal.c:507)<br>==00:00:02:05.897 30282== by 0x3BCD9A: g_closure_invoke (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.897 30282== by 0x3CD432: (within /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.897
30282== by 0x3CE956: g_signal_emit_valist (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.897 30282== by 0x3CEB18: g_signal_emit (in /lib/libgobject-2.0.so.0.1200.11)<br>==00:00:02:05.897 30282== by 0x4831D1A: gst_type_find_element_activate (
gsttypefindelement.c:743)<br>==00:00:02:05.897 30282== by 0x700622B: gst_pad_set_active (gstpad.c:648)<br>==00:00:02:05.897 30282== by 0x6FED94A: activate_pads (gstelement.c:2446)<br>==00:00:02:05.897 30282== by 0x6FF9886: gst_iterator_fold (
gstiterator.c:503)<br>==00:00:02:05.897 30282== by 0x6FED3C1: iterator_activate_fold_with_resync (gstelement.c:2478)<br>==00:00:02:05.897 30282== by 0x6FED487: gst_element_pads_activate (gstelement.c:2521)<br>==00:00:02:
05.897 30282== by 0x6FED7F5: gst_element_change_state_func (gstelement.c:2586)<br>==00:00:02:05.897 30282== by 0x4832149: gst_type_find_element_change_state (gsttypefindelement.c:770)<br>==00:00:02:05.897 30282== by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)<br>==00:00:02:05.897 30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.897 30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.897 30282== by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)<br>==00:00:02:05.897 30282== by 0x44E4D7E: gst_decode_bin_change_state (gstdecodebin.c:1694)<br>==00:00:02:05.897 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.897
30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.897 30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.897 30282== by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)<br>==00:00:02:05.897 30282== by 0x7008C96: gst_pipeline_change_state (gstpipeline.c:503)<br>==00:00:02:05.897 30282== by 0x6FEA098: gst_element_change_state (gstelement.c:2362)<br>==00:00:02:05.897 30282== by 0x6FE9DA0: gst_element_continue_state (
gstelement.c:2077)<br>==00:00:02:05.897 30282== by 0x6FEA175: gst_element_change_state (gstelement.c:2399)<br>==00:00:02:05.897 30282== by 0x6FEA4F8: gst_element_set_state_func (gstelement.c:2312)<br>==00:00:02:05.897
30282== by 0x6FE9132: gst_element_set_state (gstelement.c:2218)<br>==00:00:02:05.897 30282== by 0x80B53F0: DCAAdapterConn::transcode() (dca_adapter_conn.cpp:1044)<br>==00:00:02:05.897 30282== by 0x80B5570: DCAAdapterConn::svc() (dca_adapter_conn.cpp:1065)
<br>==00:00:02:05.898 30282==<br> </div>
<div> </div>
<div>All leaks are actually pointing to gst_static_caps_get used in decodebin. I saw a similar leak reported on this list </div>
<div> </div>
<div> <table><td class="summary"><a href="http://sourceforge.net/mailarchive/message.php?msg_id=466FFE4A.8030203%40noraisin.net">Re: [gst-devel] large memleaks</a> </td><td>Jan Schmidt <thaytan@no...> </td><td>gstreamer-devel
</td><td class="select">2007-06-13</td> </table></div>
<div> </div>
<div>My valgrind cmd is</div>
<div> </div>
<div>{</div>
<div>
<p>export G_SLICE=always-malloc<br>export G_DEBUG=gc-friendly<br>export GLIBCPP_FORCE_NEW=1<br>export GLIBCXX_FORCE_NEW=1</p>
<p>DP="/home/kgupta/gst-install/"</p>
<p><br>SUPP="--suppressions=/usr/lib/valgrind/glibc-2.3.supp<br>--suppressions=${DP}gstreamer-0.10.13/common/gst.supp<br>--suppressions=${DP}gst-plugins-base-0.10.13/common/gst.supp<br>--suppressions=${DP}gst-plugins-good-0.10.6
/common/gst.supp<br>--suppressions=${DP}gst-plugins-bad-0.10.5/common/gst.supp<br>--suppressions=${DP}gst-plugins-ugly-0.10.6/common/gst.supp<br>--suppressions=${DP}gst-ffmpeg-0.10.2/common/gst.supp"</p>
<p>OPTS="-v --trace-children=yes --track-fds=yes --time-stamp=yes<br>--tool=memcheck --leak-check=full --leak-resolution=high --log-file=./vg_results.txt<br>--freelist-vol=10000000 --show-reachable=yes --num-callers=40 ${SUPP}"
</p>
<p>$VALGRIND_INST_PREFIX/bin/valgrind $OPTS $*<br></p>
<p>}</p></div>
<div> </div>
<div>I have a few more questions about it</div>
<div>1. Is running multiple pipelines simultaneously a good idea ??</div>
<div>2. Should I try to reuse the pipelines as much as possible ??</div>
<div> </div>
<div> </div>
<div>regards</div>
<div>-kshitij</div>