[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-devel
Subject:    Re: Release RAM, when close or reload stream
From:       Aleksandr Slobodeniuk via gstreamer-devel <gstreamer-devel () lists ! freedesktop ! org
Date:       2024-04-18 12:24:43
Message-ID: CAHuwaLC4zNSG8kaPGF98NXDDCT8NwnPyS4VKoUvg8GQDsSnyqQ () mail ! gmail ! com
[Download RAW message or body]

about asan:
sorry, I wanted to write  ASAN_OPTIONS=detect_leaks=0 , so asan leak
detection won't fail the build itself.
Also another note is that it doesn't detect leaks on Windows.

Aleksandr Slobodeniuk

Senior Software Engineer

+34 936 03 42 35

Carrer de Jordi Girona, 29

08034, Barcelona, Spain.

<http://fluendo.com>

<https://es.linkedin.com/company/fluendo>   <https://twitter.com/fluendo>
<https://github.com/fluendo>


On Thu, Apr 18, 2024 at 1:42 PM Aleksandr Slobodeniuk <
aslobodeniuk@fluendo.com> wrote:

> Regarding the memory increase, it definitelly should not keep increasing
> constantly. Consider building your project with address sanitizer
> https://releases.llvm.org/11.0.0/tools/clang/docs/AddressSanitizer.html
> gcc compiler supports the same compilation flags. The output will be also
> improved if you build gstreamer and glib with sanitizer.
> If I recall correctly this can be done by
> 
> ASAN_OPTIONS=detect_leaks=1  meson build -Dintrospection=disabled
> -Db_sanitize=address
> ASAN_OPTIONS=detect_leaks=1 ninja -C build
> 
> But remember to set environment variable G_SLICE=always-malloc when
> running with glib version lesser then 2.76, otherwise memory tracking tools
> won't work.
> 
> > I am also interested in the question of changing the location in
> rtspsrc, what is the most correct tactic?
> 
> I'm not sure if setting rtspsrc to NULL is enough, I remember one project
> was setting the whole pipeline's state to NULL before changing the url of
> the rtspsrc. But the reasons behind that is that the new link was likely
> carrying a different video format, so that project preferred to rebuild the
> whole pipeline anyway.
> Maybe someone else could clarify on that.
> 
> Kind Regards,
> 
> Aleksandr Slobodeniuk
> 
> Senior Software Engineer
> 
> +34 936 03 42 35
> 
> Carrer de Jordi Girona, 29
> 
> 08034, Barcelona, Spain.
> 
> <http://fluendo.com>
> 
> <https://es.linkedin.com/company/fluendo>   <https://twitter.com/fluendo>
> <https://github.com/fluendo>
> 
> 
> On Thu, Apr 18, 2024 at 12:15 PM Deymos s via gstreamer-devel <
> gstreamer-devel@lists.freedesktop.org> wrote:
> 
> > Thanks for your answer!
> > I ended up with this
> > 
> > 0:00:27.692477868  4754 0x556f02d60960 TRACE             GST_TRACER :0::
> > object-alive, type-name=(string)GstQtSink,
> > address=(gpointer)0x556f02fa8fb0, description=(string)<qtsink0>,
> > ref-count=(uint)1, trace=(string);
> > 0:00:27.692496306  4754 0x556f02d60960 TRACE             GST_TRACER :0::
> > object-alive, type-name=(string)GstPad, address=(gpointer)0x556f02faa050,
> > description=(string)<qtsink0:sink>, ref-count=(uint)1, trace=(string);
> > 0:00:27.692503081  4754 0x556f02d60960 TRACE             GST_TRACER :0::
> > object-alive, type-name=(string)GstGLWrappedContext,
> > address=(gpointer)0x556f0329a610, description=(string)<glwrappedcontext0>,
> > ref-count=(uint)1, trace=(string);
> > 0:00:27.692508808  4754 0x556f02d60960 TRACE             GST_TRACER :0::
> > object-alive, type-name=(string)GstGLWindowX11,
> > address=(gpointer)0x556f0302cba0, description=(string)<glwindowx11-0>,
> > ref-count=(uint)1, trace=(string);
> > 0:00:27.692513557  4754 0x556f02d60960 TRACE             GST_TRACER :0::
> > object-alive, type-name=(string)GstGLDisplayX11,
> > address=(gpointer)0x556f02ff8650, description=(string)<gldisplayx11-1>,
> > ref-count=(uint)4, trace=(string);
> > 0:00:27.692518306  4754 0x556f02d60960 TRACE             GST_TRACER :0::
> > object-alive, type-name=(string)GstGLContextGLX,
> > address=(gpointer)0x7fd6b80190a0, description=(string)<glcontextglx0>,
> > ref-count=(uint)1, trace=(string);
> > 
> > but I still haven't found where and what isn't being deleted, it's
> > probably a gl Video Item from qml.
> > I am also interested in the question of changing the location in rtspsrc,
> > what is the most correct tactic?
> > 1. Change the rtspsrc state to NULL -> set a new location and run
> > 2. Or delete and recreate the entire pipeline?
> > In the first case, the memory increases anyway with the increase in the
> > number of rtsp link restarts:(
> > 
> > ср, 17 апр. 2024 г. в 18:51, Aleksandr Slobodeniuk via gstreamer-devel <
> > gstreamer-devel@lists.freedesktop.org>:
> > 
> > > Hi, this really sounds like a memory leak.
> > > Quite likely that this will help:
> > > 
> > > 1. set environment variables
> > > GST_TRACERS="leaks(name=all-leaks)" GST_DEBUG=GST_TRACER:7
> > > 2. make sure that your application calls `gst_deinit()` before it
> > > terminates.
> > > 3. run your app for a while (sounds like just opening 2 streams is
> > > enough), and then close it (so everything gstreamer-related is supposed to
> > > be freed, and the gst_deinit() is called afterwards).
> > > 
> > > If some of the objects (such as elements, buffers) remain alive (it
> > > means there was a leak) at the moment of gst_deinit(), it will print a
> > > warning to stderr, and will log each object in the gstreamer log (also
> > > stderr by default).
> > > 
> > > If you have done all the steps and do not see any leak, it's quite
> > > useful to add a leak on purpose to make sure the method works on your
> > > system. Like just adding an extra ref on something.
> > > 
> > > If it still only shows the leak you add on purpose, consider building
> > > your project with address sanitizer, this will catch all the leaks, not
> > > only in the GStreamer-related objects.
> > > 
> > > Kind Regards,
> > > 
> > > Aleksandr Slobodeniuk
> > > 
> > > Senior Software Engineer
> > > 
> > > +34 936 03 42 35
> > > 
> > > Carrer de Jordi Girona, 29
> > > 
> > > 08034, Barcelona, Spain.
> > > 
> > > <http://fluendo.com>
> > > 
> > > <https://es.linkedin.com/company/fluendo>
> > > <https://twitter.com/fluendo>   <https://github.com/fluendo>
> > > 
> > > 
> > > On Wed, Apr 17, 2024 at 4:15 PM Deymos s via gstreamer-devel <
> > > gstreamer-devel@lists.freedesktop.org> wrote:
> > > 
> > > > I am developing a video wall for 32-64 streams, I faced the problem of
> > > > increasing memory when restarting streams I have an example illustrating my
> > > > problem.
> > > > Example: https://github.com/Deymoss/Rtsp-player
> > > > 
> > > > When I start the application, a pipeline is created, as a result, the
> > > > application initially takes 54MB of RAM, when I start the stream, the
> > > > volume increases to ~ 110 MB, when I close the stream, the memory is not
> > > > freed, when I run the same stream again, the amount of RAM increases to 120
> > > > MB, and so on, 36 streams eats 5 gb RAM for 12 hours, the same is true for
> > > > file files descriptors (I suspect BUS creates them)
> > > > 
> > > > How to properly clear the memory and all information about the stream
> > > > when closing?
> > > > 
> > > > At the moment I'm setting the pipeline to NULL and not making an unref,
> > > > but if I uncomment these lines:
> > > > 
> > > > gst_bus_set_sync_handler(m_videoPipe->bus, nullptr, nullptr, \
> > > > nullptr);gst_object_unref(m_videoPipe->pipeline);gst_object_unref(m_videoPipe->bus);
> > > >  
> > > > nothing changes in memory consumption, although the refcount of each
> > > > element and the pipeline itself at the end of the function is zero.
> > > > 
> > > 


[Attachment #3 (text/html)]

<div dir="ltr">about asan:<br>sorry, I wanted to write    ASAN_OPTIONS=detect_leaks=0 \
, so asan leak detection won&#39;t fail the build itself.<br>Also another note is \
that it doesn&#39;t detect leaks on Windows.<br><br clear="all"><div><div dir="ltr" \
class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><div \
dir="ltr" style="margin-left:0pt" align="left"><table \
style="border:none;border-collapse:collapse"><colgroup><col width="220"><col \
width="175"></colgroup><tbody><tr style="height:50.25pt"><td style="border-left:solid \
#ffffff 1pt;border-right:solid #ffffff 1pt;border-bottom:solid #f915ab \
1pt;border-top:solid #ffffff 1pt;vertical-align:top;padding:5pt 5pt 5pt \
5pt;overflow:hidden"><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:700;vertical-align:baseline">Aleksandr \
Slobodeniuk</span></p><p dir="ltr" \
style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Senior \
Software Engineer</span></p></td><td style="border-left:solid #ffffff \
1pt;border-right:solid #ffffff 1pt;border-bottom:solid #f915ab 1pt;border-top:solid \
#ffffff 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(249,21,171);background-color:transparent;font-weight:700;vertical-align:baseline">+34 \
936 03 42 35</span></p><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Carrer \
de Jordi Girona, 29</span></p><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">08034, \
Barcelona, Spain.</span></p></td></tr><tr style="height:0pt"><td \
style="border-left:solid #ffffff 1pt;border-right:solid #ffffff \
1pt;border-bottom:solid #ffffff 1pt;border-top:solid #f915ab \
1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><br><p dir="ltr" \
style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="http://fluendo.com" \
target="_blank"><span \
style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:135px;height:23px"><img \
src="https://lh7-us.googleusercontent.com/7f4gLdr2vrB3tXPMwJmLsq1xFFFqPKnq7My8TnumcBKp \
IMI0HfrvUTStJeCYVUP7FynvoYZw1jq-6fQtHdK7u3qLC7NEmPMet6iQkYpoPcyp3EUYQBrOnhgFYa7XDzgeDkJjVBknQdmb76YE2o3c63s" \
width="135" height="23" \
style="margin-left:0px;margin-top:0px"></span></span></a></p></td><td \
style="border-left:solid #ffffff 1pt;border-right:solid #ffffff \
1pt;border-bottom:solid #ffffff 1pt;border-top:solid #f915ab \
1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden"><br><p dir="ltr" \
style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a \
href="https://es.linkedin.com/company/fluendo" target="_blank"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:23px;height:22px"><img \
src="https://lh7-us.googleusercontent.com/OzDx4NDORH8FwQh0Ux7Eqszty4oDNvLyo5ad22JS7q56 \
cErOlNi67GdfCqrm0usd5BLylF7NHaveLM3xgRy99wMKYbhF-BxnrlHeUpOzDHYrG0E70Yb78WFAZuuTG4XQAgSVBxhPIXz3WvcK2_PrW9I" \
width="23" height="22" style="margin-left:0px;margin-top:0px"></span></span></a><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span><a href="https://twitter.com/fluendo" target="_blank"><span \
style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:22px;height:22px"><img \
src="https://lh7-us.googleusercontent.com/dP_zElA4XMeIAQtvlavqqCuEG9zesjnBeqAMRtw-5HKz \
aLT5nyX49DGsOuwokHCOLVQZTvc1Ng7NPJ8ozUhweGF6BWx-33UYp5XEQSCAcefq4NfZOUGRQgRVWvv5Jyb725Rlc-zuXkM-T-MXCmqfVqo" \
width="22" height="22" style="margin-left:0px;margin-top:0px"></span></span></a><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span><a href="https://github.com/fluendo" target="_blank"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:24px;height:23px"><img \
src="https://lh7-us.googleusercontent.com/xe27dLIuIPtsQqcHCI4EhUQzqxQmQTe3h0rsuabYwOv8 \
-BoHKM50vhxMKUsssJ91DmCTt_MsYCwxQmZq-8bIQY-9e3TFdbr3ckIfX3eSx1YKF5JB7LgH7v6qbjsn0ntflPyrb694cH-t9BYspEeZK-Q" \
width="24" height="23" style="margin-left:0px;margin-top:0px"></span></span></a><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span></p></td></tr></tbody></table></div></span></div></div></div><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 18, 2024 at \
1:42 PM Aleksandr Slobodeniuk &lt;<a \
href="mailto:aslobodeniuk@fluendo.com">aslobodeniuk@fluendo.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div \
dir="ltr">Regarding the memory increase, it definitelly should not keep increasing \
constantly. Consider building your project with address sanitizer<br><a \
href="https://releases.llvm.org/11.0.0/tools/clang/docs/AddressSanitizer.html" \
target="_blank">https://releases.llvm.org/11.0.0/tools/clang/docs/AddressSanitizer.html</a><br>gcc \
compiler supports the same compilation flags. The output will be also improved if you \
build gstreamer and glib with sanitizer.<br>If I recall correctly this can be done \
by<br><br><span style="color:rgb(51,51,51);font-family:monospace;font-size:11.7px;text \
-align:justify;background-color:rgb(226,226,226)">ASAN_OPTIONS=detect_leaks=1</span>  \
meson build -Dintrospection=disabled -Db_sanitize=address<br><span \
style="color:rgb(51,51,51);font-family:monospace;font-size:11.7px;text-align:justify;background-color:rgb(226,226,226)">ASAN_OPTIONS=detect_leaks=1 \
ninja -C build</span><br><br>But remember to set environment variable \
G_SLICE=always-malloc when running with glib version lesser then 2.76, otherwise \
memory tracking tools won&#39;t work.<br><br>&gt;  

I am also interested in the question of changing the location in rtspsrc, what is the \
most correct tactic?<br><br>I&#39;m not sure if setting rtspsrc to NULL is enough, I \
remember one project was setting the whole pipeline&#39;s state to NULL before \
changing the url of the rtspsrc. But the reasons behind that is that the new link was \
likely carrying a different video format, so that project preferred to rebuild the \
whole pipeline anyway.<br>Maybe someone else could clarify on that.<br><br>Kind \
Regards,<br><br clear="all"><div><div dir="ltr" class="gmail_signature"><div \
dir="ltr"><span><div dir="ltr" style="margin-left:0pt" align="left"><table \
style="border:none;border-collapse:collapse"><colgroup><col width="220"><col \
width="175"></colgroup><tbody><tr style="height:50.25pt"><td \
style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255) \
rgb(255,255,255) rgb(249,21,171);vertical-align:top;padding:5pt;overflow:hidden"><p \
dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:700;vertical-align:baseline">Aleksandr \
Slobodeniuk</span></p><p dir="ltr" \
style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Senior \
Software Engineer</span></p></td><td \
style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255) \
rgb(255,255,255) rgb(249,21,171);vertical-align:top;padding:5pt;overflow:hidden"><p \
dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(249,21,171);background-color:transparent;font-weight:700;vertical-align:baseline">+34 \
936 03 42 35</span></p><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Carrer \
de Jordi Girona, 29</span></p><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">08034, \
Barcelona, Spain.</span></p></td></tr><tr style="height:0pt"><td \
style="border-width:1pt;border-style:solid;border-color:rgb(249,21,171) \
rgb(255,255,255) rgb(255,255,255);vertical-align:top;padding:5pt;overflow:hidden"><br><p \
dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a \
href="http://fluendo.com" target="_blank"><span \
style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:135px;height:23px"><img \
src="https://lh7-us.googleusercontent.com/7f4gLdr2vrB3tXPMwJmLsq1xFFFqPKnq7My8TnumcBKp \
IMI0HfrvUTStJeCYVUP7FynvoYZw1jq-6fQtHdK7u3qLC7NEmPMet6iQkYpoPcyp3EUYQBrOnhgFYa7XDzgeDkJjVBknQdmb76YE2o3c63s" \
width="135" height="23" style="margin-left: 0px; margin-top: \
0px;"></span></span></a></p></td><td \
style="border-width:1pt;border-style:solid;border-color:rgb(249,21,171) \
rgb(255,255,255) rgb(255,255,255);vertical-align:top;padding:5pt;overflow:hidden"><br><p \
dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a \
href="https://es.linkedin.com/company/fluendo" target="_blank"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:23px;height:22px"><img \
src="https://lh7-us.googleusercontent.com/OzDx4NDORH8FwQh0Ux7Eqszty4oDNvLyo5ad22JS7q56 \
cErOlNi67GdfCqrm0usd5BLylF7NHaveLM3xgRy99wMKYbhF-BxnrlHeUpOzDHYrG0E70Yb78WFAZuuTG4XQAgSVBxhPIXz3WvcK2_PrW9I" \
width="23" height="22" style="margin-left: 0px; margin-top: \
0px;"></span></span></a><span style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span><a href="https://twitter.com/fluendo" target="_blank"><span \
style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:22px;height:22px"><img \
src="https://lh7-us.googleusercontent.com/dP_zElA4XMeIAQtvlavqqCuEG9zesjnBeqAMRtw-5HKz \
aLT5nyX49DGsOuwokHCOLVQZTvc1Ng7NPJ8ozUhweGF6BWx-33UYp5XEQSCAcefq4NfZOUGRQgRVWvv5Jyb725Rlc-zuXkM-T-MXCmqfVqo" \
width="22" height="22" style="margin-left: 0px; margin-top: \
0px;"></span></span></a><span style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span><a href="https://github.com/fluendo" target="_blank"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span \
style="border:none;display:inline-block;overflow:hidden;width:24px;height:23px"><img \
src="https://lh7-us.googleusercontent.com/xe27dLIuIPtsQqcHCI4EhUQzqxQmQTe3h0rsuabYwOv8 \
-BoHKM50vhxMKUsssJ91DmCTt_MsYCwxQmZq-8bIQY-9e3TFdbr3ckIfX3eSx1YKF5JB7LgH7v6qbjsn0ntflPyrb694cH-t9BYspEeZK-Q" \
width="24" height="23" style="margin-left: 0px; margin-top: \
0px;"></span></span></a><span style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span></p></td></tr></tbody></table></div></span></div></div></div><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 18, 2024 at \
12:15 PM Deymos s via gstreamer-devel &lt;<a \
href="mailto:gstreamer-devel@lists.freedesktop.org" \
target="_blank">gstreamer-devel@lists.freedesktop.org</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks \
for your answer!<br>I ended up with this<br><br>0:00:27.692477868   4754 \
0x556f02d60960 TRACE                   GST_TRACER :0:: object-alive, \
type-name=(string)GstQtSink, address=(gpointer)0x556f02fa8fb0, \
description=(string)&lt;qtsink0&gt;, ref-count=(uint)1, \
trace=(string);<br>0:00:27.692496306   4754 0x556f02d60960 TRACE                   \
GST_TRACER :0:: object-alive, type-name=(string)GstPad, \
address=(gpointer)0x556f02faa050, description=(string)&lt;qtsink0:sink&gt;, \
ref-count=(uint)1, trace=(string);<br>0:00:27.692503081   4754 0x556f02d60960 TRACE   \
GST_TRACER :0:: object-alive, type-name=(string)GstGLWrappedContext, \
address=(gpointer)0x556f0329a610, description=(string)&lt;glwrappedcontext0&gt;, \
ref-count=(uint)1, trace=(string);<br>0:00:27.692508808   4754 0x556f02d60960 TRACE   \
GST_TRACER :0:: object-alive, type-name=(string)GstGLWindowX11, \
address=(gpointer)0x556f0302cba0, description=(string)&lt;glwindowx11-0&gt;, \
ref-count=(uint)1, trace=(string);<br>0:00:27.692513557   4754 0x556f02d60960 TRACE   \
GST_TRACER :0:: object-alive, type-name=(string)GstGLDisplayX11, \
address=(gpointer)0x556f02ff8650, description=(string)&lt;gldisplayx11-1&gt;, \
ref-count=(uint)4, trace=(string);<br>0:00:27.692518306   4754 0x556f02d60960 TRACE   \
GST_TRACER :0:: object-alive, type-name=(string)GstGLContextGLX, \
address=(gpointer)0x7fd6b80190a0, description=(string)&lt;glcontextglx0&gt;, \
ref-count=(uint)1, trace=(string);<br><br> but I still haven&#39;t found where and \
what isn&#39;t being deleted, it&#39;s probably a gl Video Item from qml.<br>I am \
also interested in the question of changing the location in rtspsrc, what is the most \
correct tactic?<br>1. Change the rtspsrc state to NULL -&gt; set a new location and \
run<br>2. Or delete and recreate the entire pipeline?<br>In the first case, the \
memory increases anyway with the increase in the number of rtsp link \
restarts:(</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ср, \
17 апр. 2024 г. в 18:51, Aleksandr Slobodeniuk via gstreamer-devel &lt;<a \
href="mailto:gstreamer-devel@lists.freedesktop.org" \
target="_blank">gstreamer-devel@lists.freedesktop.org</a>&gt;:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, this really sounds like a \
memory leak.<br>Quite likely that this will help:<br><br>1. set environment \
variables<br><span style="color:rgb(29,28,29);font-family:Monaco,Menlo,Consolas,&quot;Courier \
New&quot;,monospace;font-size:12px;font-variant-ligatures:none;background-color:rgba(29,28,29,0.04)">GST_TRACERS=&quot;leaks(name=all-leaks)&quot; \
GST_DEBUG=GST_TRACER:7</span><br>2. make sure that your application calls \
`gst_deinit()` before it terminates.<br>3. run your app for a while (sounds like just \
opening 2 streams is enough), and then close it (so everything gstreamer-related is \
supposed to be freed, and the gst_deinit() is called afterwards).<br><br>If some of \
the objects (such as elements, buffers) remain alive (it means there was a leak) at \
the moment of gst_deinit(), it will print a warning to stderr, and will log each \
object in the gstreamer log (also stderr by default).<br><br>If you have done all the \
steps and do not see any leak, it&#39;s quite useful to add a leak on purpose to make \
sure the method works on your system. Like just adding an extra ref on \
something.<br><br>If it still only shows the leak you add on purpose, consider \
building your project with address sanitizer, this will catch all the leaks, not only \
in the GStreamer-related objects.<br><br>Kind Regards,<br><br clear="all"><div><div \
dir="ltr" class="gmail_signature"><div dir="ltr"><span><div dir="ltr" \
style="margin-left:0pt" align="left"><table \
style="border:medium;border-collapse:collapse"><colgroup><col width="220"><col \
width="175"></colgroup><tbody><tr style="height:50.25pt"><td \
style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255) \
rgb(255,255,255) rgb(249,21,171);vertical-align:top;padding:5pt;overflow:hidden"><p \
dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:700;vertical-align:baseline">Aleksandr \
Slobodeniuk</span></p><p dir="ltr" \
style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Senior \
Software Engineer</span></p></td><td \
style="border-width:1pt;border-style:solid;border-color:rgb(255,255,255) \
rgb(255,255,255) rgb(249,21,171);vertical-align:top;padding:5pt;overflow:hidden"><p \
dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(249,21,171);background-color:transparent;font-weight:700;vertical-align:baseline">+34 \
936 03 42 35</span></p><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">Carrer \
de Jordi Girona, 29</span></p><p dir="ltr" \
style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span \
style="font-size:8pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline">08034, \
Barcelona, Spain.</span></p></td></tr><tr style="height:0pt"><td \
style="border-width:1pt;border-style:solid;border-color:rgb(249,21,171) \
rgb(255,255,255) rgb(255,255,255);vertical-align:top;padding:5pt;overflow:hidden"><br><p \
dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a \
href="http://fluendo.com" target="_blank"><span \
style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span \
style="border:medium;display:inline-block;overflow:hidden;width:135px;height:23px"><img \
src="https://lh7-us.googleusercontent.com/7f4gLdr2vrB3tXPMwJmLsq1xFFFqPKnq7My8TnumcBKp \
IMI0HfrvUTStJeCYVUP7FynvoYZw1jq-6fQtHdK7u3qLC7NEmPMet6iQkYpoPcyp3EUYQBrOnhgFYa7XDzgeDkJjVBknQdmb76YE2o3c63s" \
width="135" height="23" style="margin-left: 0px; margin-top: \
0px;"></span></span></a></p></td><td \
style="border-width:1pt;border-style:solid;border-color:rgb(249,21,171) \
rgb(255,255,255) rgb(255,255,255);vertical-align:top;padding:5pt;overflow:hidden"><br><p \
dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a \
href="https://es.linkedin.com/company/fluendo" target="_blank"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span \
style="border:medium;display:inline-block;overflow:hidden;width:23px;height:22px"><img \
src="https://lh7-us.googleusercontent.com/OzDx4NDORH8FwQh0Ux7Eqszty4oDNvLyo5ad22JS7q56 \
cErOlNi67GdfCqrm0usd5BLylF7NHaveLM3xgRy99wMKYbhF-BxnrlHeUpOzDHYrG0E70Yb78WFAZuuTG4XQAgSVBxhPIXz3WvcK2_PrW9I" \
width="23" height="22" style="margin-left: 0px; margin-top: \
0px;"></span></span></a><span style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span><a href="https://twitter.com/fluendo" target="_blank"><span \
style="font-size:11pt;font-family:Arial,sans-serif;color:rgb(17,85,204);background-color:transparent;vertical-align:baseline"><span \
style="border:medium;display:inline-block;overflow:hidden;width:22px;height:22px"><img \
src="https://lh7-us.googleusercontent.com/dP_zElA4XMeIAQtvlavqqCuEG9zesjnBeqAMRtw-5HKz \
aLT5nyX49DGsOuwokHCOLVQZTvc1Ng7NPJ8ozUhweGF6BWx-33UYp5XEQSCAcefq4NfZOUGRQgRVWvv5Jyb725Rlc-zuXkM-T-MXCmqfVqo" \
width="22" height="22" style="margin-left: 0px; margin-top: \
0px;"></span></span></a><span style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span><a href="https://github.com/fluendo" target="_blank"><span \
style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(17,85,204);background-color:transparent;font-weight:700;vertical-align:baseline"><span \
style="border:medium;display:inline-block;overflow:hidden;width:24px;height:23px"><img \
src="https://lh7-us.googleusercontent.com/xe27dLIuIPtsQqcHCI4EhUQzqxQmQTe3h0rsuabYwOv8 \
-BoHKM50vhxMKUsssJ91DmCTt_MsYCwxQmZq-8bIQY-9e3TFdbr3ckIfX3eSx1YKF5JB7LgH7v6qbjsn0ntflPyrb694cH-t9BYspEeZK-Q" \
width="24" height="23" style="margin-left: 0px; margin-top: \
0px;"></span></span></a><span style="font-size:10pt;font-family:&quot;DM \
Sans&quot;,sans-serif;color:rgb(51,113,242);background-color:transparent;font-weight:700;vertical-align:baseline"> \
</span></p></td></tr></tbody></table></div></span></div></div></div><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 17, 2024 at \
4:15 PM Deymos s via gstreamer-devel &lt;<a \
href="mailto:gstreamer-devel@lists.freedesktop.org" \
target="_blank">gstreamer-devel@lists.freedesktop.org</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p>I am \
developing a video wall for 32-64 streams, I faced the problem of increasing memory \
when restarting streams I have an example illustrating my problem.<br>
Example: <a href="https://github.com/Deymoss/Rtsp-player" rel="nofollow noreferrer" \
target="_blank">https://github.com/Deymoss/Rtsp-player</a></p> <p>When I start the \
application, a pipeline is created, as a result, the  application initially takes \
54MB of RAM, when I start the stream, the  volume increases to ~ 110 MB, when I close \
the stream, the memory is not  freed, when I run the same stream again, the amount of \
RAM increases to  120 MB, and so on, 36 streams eats 5 gb RAM for 12 hours, the same \
is true for file files descriptors (I  suspect BUS creates them)</p>
<p>How to properly clear the memory and all information about the stream when \
closing?</p> <p>At the moment I&#39;m setting the pipeline to NULL and not making an \
unref, but if I uncomment these lines:</p> \
<pre><code><span>gst_bus_set_sync_handler</span>(m_videoPipe-&gt;bus, \
<span>nullptr</span>, <span>nullptr</span>, <span>nullptr</span>); \
<span>gst_object_unref</span>(m_videoPipe-&gt;pipeline); \
<span>gst_object_unref</span>(m_videoPipe-&gt;bus); </code></pre>
<p>nothing changes in memory consumption, although the refcount of each 
element and the pipeline itself at the end of the function is zero.</p></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic