Re: Something strange with RAM consumption
Nicolas Dufresne via gstreamer-devel <[email protected]> Wed, 26 Jun 2024 14:19:28 -0400
| Newsgroups | gmane.comp.video.gstreamer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, Le mercredi 26 juin 2024 à 15:56 +0300, Deymos s via gstreamer-devel a écrit : > 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) > Example: https://github.com/Deymoss/Rtsp-player 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. Nicolas > 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) > How to properly clear the memory and all information about the stream when > closing? > Here are GST_TRACER and ASAN output: > 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); > > 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); > > 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); > > 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); > > 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); > > 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); > > ** (rtsp-player:79361): WARNING **: 15:36:23.197: Leaks detected and logged > under GST_DEBUG=GST_TRACER:7 > > ================================================================= > ==79361==ERROR: LeakSanitizer: detected memory leaks > > Direct leak of 49152 byte(s) in 2 object(s) allocated from: > #0 0x72a00c2b4887 in __interceptor_malloc > ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 > #1 0x72a00bda1738 in g_malloc (/lib/x86_64-linux-gnu/libglib- > 2.0.so.0+0x5e738) > > Direct leak of 8832 byte(s) in 1 object(s) allocated from: > #0 0x72a00c2b4887 in __interceptor_malloc > ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 > #1 0x729fffeaa7b3 (/lib/x86_64-linux-gnu/libGLX_mesa.so.0+0x317b3) > > Direct leak of 2560 byte(s) in 10 object(s) allocated from: > #0 0x72a00c2b4887 in __interceptor_malloc > ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 > #1 0x72a00228ca21 (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x1fa21) > > Direct leak of 56 byte(s) in 2 object(s) allocated from: > #0 0x72a00c2b4887 in __interceptor_malloc > ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145 > #1 0x72a002275ce9 (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x8ce9) > > Indirect leak of 608 byte(s) in 19 object(s) allocated from: > #0 0x72a00c2b4a57 in __interceptor_calloc > ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154 > #1 0x72a00228f51e (/lib/x86_64-linux-gnu/libfontconfig.so.1+0x2251e) > > Indirect leak of 198 byte(s) in 18 object(s) allocated from: > #0 0x72a00c25b9a7 in __interceptor_strdup > ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454 > #1 0x72a00228c4f7 in FcValueSave (/lib/x86_64-linux- > gnu/libfontconfig.so.1+0x1f4f7) > > SUMMARY: AddressSanitizer: 61406 byte(s) leaked in 52 allocation(s).