<html><head><style>pre,code,address {
  margin: 0px;
}
h1,h2,h3,h4,h5,h6 {
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}
ol,ul {
  margin-top: 0em;
  margin-bottom: 0em;
}
blockquote {
  margin-top: 0em;
  margin-bottom: 0em;
}
</style></head><body><div>Hi,</div><div><br></div><div>Le mercredi 26 juin 2024 à 15:56 +0300, Deymos s via gstreamer-devel a écrit :</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><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. (Here is 2 branches with qt5 and qt6 realization)<br>Example: <a href="https://github.com/Deymoss/Rtsp-player" rel="nofollow noreferrer" target="_blank">https://github.com/Deymoss/Rtsp-player</a></p></div></div></blockquote><div><br></div><div>A quick look at your code gives me the impression that nothing will pop the messages from the GstBus, which will cause a run-time leak (but it get freed  at shutdown). If you have glib enabled in your QT setup, calling gst_bus_add_watch() or gst_bus_add_signal_watch() could possibly solve the issue. If you don't you will need a thread to pop the messages and process them, so they don't accumulate forever.</div><div><br></div><div>Nicolas</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><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 RAM consumption 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?<br></p><p>Here are GST_TRACER and ASAN output:<br>0:00:30.915950297 79361 0x619000078350 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstProxyPad, address=(gpointer)0x629000092380, description=(string)<sink:proxypad1>, ref-count=(uint)1, trace=(string);<br><br>0:00:30.915977127 79361 0x619000078350 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstGhostPad, address=(gpointer)0x62900008e2d0, description=(string)<'':sink>, ref-count=(uint)1, trace=(string);<br><br>0:00:30.915992116 79361 0x619000078350 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstGLWrappedContext, address=(gpointer)0x62500024f610, description=(string)<glwrappedcontext0>, ref-count=(uint)1, trace=(string);<br><br>0:00:30.916002956 79361 0x619000078350 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstGLWindowX11, address=(gpointer)0x6290000a2ba0, description=(string)<glwindowx11-0>, ref-count=(uint)1, trace=(string);<br><br>0:00:30.916014989 79361 0x619000078350 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstGLDisplayX11, address=(gpointer)0x62500024c650, description=(string)<gldisplayx11-1>, ref-count=(uint)4, trace=(string);<br><br>0:00:30.916022784 79361 0x619000078350 TRACE             GST_TRACER :0:: object-alive, type-name=(string)GstGLContextGLX, address=(gpointer)0x6250004340a0, description=(string)<glcontextglx0>, ref-count=(uint)1, trace=(string);<br><br>** (rtsp-player:79361): WARNING **: 15:36:23.197: Leaks detected and logged under GST_DEBUG=GST_TRACER:7<br><br>=================================================================<br>==79361==ERROR: LeakSanitizer: detected memory leaks<br><br>Direct leak of 49152 byte(s) in 2 object(s) allocated from:<br>    #0 0x72a00c2b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145<br>    #1 0x72a00bda1738 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5e738)<br><br>Direct leak of 8832 byte(s) in 1 object(s) allocated from:<br>    #0 0x72a00c2b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145<br>    #1 0x729fffeaa7b3  (/lib/x86_64-linux-gnu/libGLX_mesa.so.0+0x317b3)<br><br>Direct leak of 2560 byte(s) in 10 object(s) allocated from:<br>    #0 0x72a00c2b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145<br>    #1 0x72a00228ca21  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1fa21)<br><br>Direct leak of 56 byte(s) in 2 object(s) allocated from:<br>    #0 0x72a00c2b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145<br>    #1 0x72a002275ce9  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x8ce9)<br><br>Indirect leak of 608 byte(s) in 19 object(s) allocated from:<br>    #0 0x72a00c2b4a57 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154<br>    #1 0x72a00228f51e  (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2251e)<br><br>Indirect leak of 198 byte(s) in 18 object(s) allocated from:<br>    #0 0x72a00c25b9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454<br>    #1 0x72a00228c4f7 in FcValueSave (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1f4f7)<br><br>SUMMARY: AddressSanitizer: 61406 byte(s) leaked in 52 allocation(s).</p></div></div></blockquote><div><br></div><div><span></span></div></body></html>