[gst-devel] running multiple pipelines simultaneously

Kshitij Gupta gupta.kshi at gmail.com
Wed Aug 8 10:38:09 CEST 2007


Hi,
   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.
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.
I ran this through valgrind and found some big memory leaks

==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
==00:00:02:05.878 30282==    at 0x40054E5: malloc (vg_replace_malloc.c:149)
==00:00:02:05.878 30282==    by 0x20DA55: g_malloc (in /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x21D7B7: g_slice_alloc (in /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x1E86CA: g_ptr_array_sized_new (in
/lib/libglib-2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x1E8711: g_ptr_array_new (in /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x6FE3476: gst_static_caps_get (gstcaps.c
:460)
==00:00:02:05.879 30282==    by 0x44E2BC0: close_pad_link (gstdecodebin.c
:525)
==00:00:02:05.879 30282==    by 0x44E3D8C: type_found (gstdecodebin.c:1559)
==00:00:02:05.879 30282==    by 0x70333CC: gst_marshal_VOID__UINT_BOXED (
gstmarshal.c:507)
==00:00:02:05.879 30282==    by 0x3BCD9A: g_closure_invoke (in
/lib/libgobject-2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x3CD432: (within /lib/libgobject-
2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x3CE956: g_signal_emit_valist (in
/lib/libgobject-2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x3CEB18: g_signal_emit (in /lib/libgobject-
2.0.so.0.1200.11)
==00:00:02:05.879 30282==    by 0x4831D1A: gst_type_find_element_activate (
gsttypefindelement.c:743)
==00:00:02:05.879 30282==    by 0x700622B: gst_pad_set_active (gstpad.c:648)
==00:00:02:05.879 30282==    by 0x6FED94A: activate_pads (gstelement.c:2446)
==00:00:02:05.879 30282==    by 0x6FF9886: gst_iterator_fold (gstiterator.c
:503)
==00:00:02:05.879 30282==    by 0x6FED3C1:
iterator_activate_fold_with_resync (gstelement.c:2478)
==00:00:02:05.879 30282==    by 0x6FED487: gst_element_pads_activate (
gstelement.c:2521)
==00:00:02:05.879 30282==    by 0x6FED7F5: gst_element_change_state_func (
gstelement.c:2586)
==00:00:02:05.879 30282==    by 0x4832149:
gst_type_find_element_change_state (gsttypefindelement.c:770)
==00:00:02:05.879 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.879 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.879 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.879 30282==    by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)
==00:00:02:05.879 30282==    by 0x44E4D7E: gst_decode_bin_change_state (
gstdecodebin.c:1694)
==00:00:02:05.879 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.879 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.879 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.879 30282==    by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)
==00:00:02:05.879 30282==    by 0x7008C96: gst_pipeline_change_state (
gstpipeline.c:503)
==00:00:02:05.879 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.879 30282==    by 0x6FE9DA0: gst_element_continue_state (
gstelement.c:2077)
==00:00:02:05.879 30282==    by 0x6FEA175: gst_element_change_state (
gstelement.c:2399)
==00:00:02:05.879 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.879 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.879 30282==    by 0x80B53F0: Session::play() (session.cpp
:1044)
==00:00:02:05.879 30282==    by 0x80B5570: Session::svc() (session.cpp:1065)
==00:00:02:05.879 30282==    by 0x410D6E5: ACE_Task_Base::svc_run(void*) (
Task.cpp:254)
==00:00:02:05.879 30282==    by 0x410E257: ACE_Thread_Adapter::invoke_i()
(Thread_Adapter.cpp:151)
==00:00:02:05.879 30282==


==00:00:02:05.899 30282== 35,136 bytes in 283 blocks are indirectly lost in
loss record 8,740 of 8,741
==00:00:02:05.899 30282==    at 0x40055E2: realloc (vg_replace_malloc.c:306)
==00:00:02:05.899 30282==    by 0x20D91A: g_realloc (in /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x1E877F: (within /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x1E8F28: g_array_append_vals (in
/lib/libglib-2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x7012D9C: gst_structure_set_field (
gststructure.c:593)
==00:00:02:05.899 30282==    by 0x7015175: gst_structure_from_string (
gststructure.c:1848)
==00:00:02:05.899 30282==    by 0x6FE2F40: gst_caps_from_string_inplace (
gstcaps.c:1821)
==00:00:02:05.899 30282==    by 0x6FE349D: gst_static_caps_get (gstcaps.c
:467)
==00:00:02:05.899 30282==    by 0x44E2BC0: close_pad_link (gstdecodebin.c
:525)
==00:00:02:05.899 30282==    by 0x44E3D8C: type_found (gstdecodebin.c:1559)
==00:00:02:05.899 30282==    by 0x70333CC: gst_marshal_VOID__UINT_BOXED (
gstmarshal.c:507)
==00:00:02:05.899 30282==    by 0x3BCD9A: g_closure_invoke (in
/lib/libgobject-2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x3CD432: (within /lib/libgobject-
2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x3CE956: g_signal_emit_valist (in
/lib/libgobject-2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x3CEB18: g_signal_emit (in /lib/libgobject-
2.0.so.0.1200.11)
==00:00:02:05.899 30282==    by 0x4831D1A: gst_type_find_element_activate (
gsttypefindelement.c:743)
==00:00:02:05.899 30282==    by 0x700622B: gst_pad_set_active (gstpad.c:648)
==00:00:02:05.899 30282==    by 0x6FED94A: activate_pads (gstelement.c:2446)
==00:00:02:05.899 30282==    by 0x6FF9886: gst_iterator_fold (gstiterator.c
:503)
==00:00:02:05.899 30282==    by 0x6FED3C1:
iterator_activate_fold_with_resync (gstelement.c:2478)
==00:00:02:05.899 30282==    by 0x6FED487: gst_element_pads_activate (
gstelement.c:2521)
==00:00:02:05.899 30282==    by 0x6FED7F5: gst_element_change_state_func (
gstelement.c:2586)
==00:00:02:05.899 30282==    by 0x4832149:
gst_type_find_element_change_state (gsttypefindelement.c:770)
==00:00:02:05.899 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.899 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.899 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.899 30282==    by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)
==00:00:02:05.899 30282==    by 0x44E4D7E: gst_decode_bin_change_state (
gstdecodebin.c:1694)
==00:00:02:05.899 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.899 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.899 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.899 30282==    by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)
==00:00:02:05.899 30282==    by 0x7008C96: gst_pipeline_change_state (
gstpipeline.c:503)
==00:00:02:05.899 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.899 30282==    by 0x6FE9DA0: gst_element_continue_state (
gstelement.c:2077)
==00:00:02:05.899 30282==    by 0x6FEA175: gst_element_change_state (
gstelement.c:2399)
==00:00:02:05.899 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.899 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.899 30282==    by 0x80B53F0: DCAAdapterConn::transcode()
(dca_adapter_conn.cpp:1044)
==00:00:02:05.899 30282==    by 0x80B5570: DCAAdapterConn::svc()
(dca_adapter_conn.cpp:1065)
==00:00:02:05.900 30282==


==00:00:02:05.897 30282== 24,704 bytes in 386 blocks are indirectly lost in
loss record 8,738 of 8,741
==00:00:02:05.897 30282==    at 0x40054E5: malloc (vg_replace_malloc.c:149)
==00:00:02:05.897 30282==    by 0x400556F: realloc (vg_replace_malloc.c:306)
==00:00:02:05.897 30282==    by 0x20D91A: g_realloc (in /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x1E81D7: (within /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x1E8239: g_ptr_array_add (in /lib/libglib-
2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x6FE2E85: gst_caps_append_structure (
gstcaps.c:696)
==00:00:02:05.897 30282==    by 0x6FE2F57: gst_caps_from_string_inplace (
gstcaps.c:1825)
==00:00:02:05.897 30282==    by 0x6FE349D: gst_static_caps_get (gstcaps.c
:467)
==00:00:02:05.897 30282==    by 0x44E2BC0: close_pad_link (gstdecodebin.c
:525)
==00:00:02:05.897 30282==    by 0x44E3D8C: type_found (gstdecodebin.c:1559)
==00:00:02:05.897 30282==    by 0x70333CC: gst_marshal_VOID__UINT_BOXED (
gstmarshal.c:507)
==00:00:02:05.897 30282==    by 0x3BCD9A: g_closure_invoke (in
/lib/libgobject-2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x3CD432: (within /lib/libgobject-
2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x3CE956: g_signal_emit_valist (in
/lib/libgobject-2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x3CEB18: g_signal_emit (in /lib/libgobject-
2.0.so.0.1200.11)
==00:00:02:05.897 30282==    by 0x4831D1A: gst_type_find_element_activate (
gsttypefindelement.c:743)
==00:00:02:05.897 30282==    by 0x700622B: gst_pad_set_active (gstpad.c:648)
==00:00:02:05.897 30282==    by 0x6FED94A: activate_pads (gstelement.c:2446)
==00:00:02:05.897 30282==    by 0x6FF9886: gst_iterator_fold (gstiterator.c
:503)
==00:00:02:05.897 30282==    by 0x6FED3C1:
iterator_activate_fold_with_resync (gstelement.c:2478)
==00:00:02:05.897 30282==    by 0x6FED487: gst_element_pads_activate (
gstelement.c:2521)
==00:00:02:05.897 30282==    by 0x6FED7F5: gst_element_change_state_func (
gstelement.c:2586)
==00:00:02:05.897 30282==    by 0x4832149:
gst_type_find_element_change_state (gsttypefindelement.c:770)
==00:00:02:05.897 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.897 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.897 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.897 30282==    by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)
==00:00:02:05.897 30282==    by 0x44E4D7E: gst_decode_bin_change_state (
gstdecodebin.c:1694)
==00:00:02:05.897 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.897 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.897 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.897 30282==    by 0x6FDD494: gst_bin_change_state_func (
gstbin.c:1953)
==00:00:02:05.897 30282==    by 0x7008C96: gst_pipeline_change_state (
gstpipeline.c:503)
==00:00:02:05.897 30282==    by 0x6FEA098: gst_element_change_state (
gstelement.c:2362)
==00:00:02:05.897 30282==    by 0x6FE9DA0: gst_element_continue_state (
gstelement.c:2077)
==00:00:02:05.897 30282==    by 0x6FEA175: gst_element_change_state (
gstelement.c:2399)
==00:00:02:05.897 30282==    by 0x6FEA4F8: gst_element_set_state_func (
gstelement.c:2312)
==00:00:02:05.897 30282==    by 0x6FE9132: gst_element_set_state (
gstelement.c:2218)
==00:00:02:05.897 30282==    by 0x80B53F0: DCAAdapterConn::transcode()
(dca_adapter_conn.cpp:1044)
==00:00:02:05.897 30282==    by 0x80B5570: DCAAdapterConn::svc()
(dca_adapter_conn.cpp:1065)
==00:00:02:05.898 30282==


All leaks are actually pointing to gst_static_caps_get used in decodebin.  I
saw a similar leak reported on this list

 Re: [gst-devel] large
memleaks<http://sourceforge.net/mailarchive/message.php?msg_id=466FFE4A.8030203%40noraisin.net>
Jan
Schmidt <thaytan at no...> gstreamer-devel 2007-06-13

My valgrind cmd is

{

export G_SLICE=always-malloc
export G_DEBUG=gc-friendly
export GLIBCPP_FORCE_NEW=1
export GLIBCXX_FORCE_NEW=1

DP="/home/kgupta/gst-install/"


SUPP="--suppressions=/usr/lib/valgrind/glibc-2.3.supp
--suppressions=${DP}gstreamer-0.10.13/common/gst.supp
--suppressions=${DP}gst-plugins-base-0.10.13/common/gst.supp
--suppressions=${DP}gst-plugins-good-0.10.6/common/gst.supp
--suppressions=${DP}gst-plugins-bad-0.10.5/common/gst.supp
--suppressions=${DP}gst-plugins-ugly-0.10.6/common/gst.supp
--suppressions=${DP}gst-ffmpeg-0.10.2/common/gst.supp"

OPTS="-v --trace-children=yes --track-fds=yes --time-stamp=yes
--tool=memcheck --leak-check=full --leak-resolution=high
--log-file=./vg_results.txt
--freelist-vol=10000000 --show-reachable=yes --num-callers=40 ${SUPP}"

$VALGRIND_INST_PREFIX/bin/valgrind $OPTS $*

}

I have a few more questions about it
1. Is running multiple pipelines simultaneously a good idea ??
2. Should I try to reuse the pipelines as much as possible ??


regards
-kshitij
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070808/f55101b1/attachment.htm>


More information about the gstreamer-devel mailing list