gStreamer memory leak observed when restarting the pipeline multiple times

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gStreamer memory leak observed when restarting the pipeline multiple times

surajketan

Hi All,

I have a simple program which has the following pipeline: rtspsrc ! decodebin ! videoconvert ! videorate ! appsink The pipeline is started using gst_parse_launch(). For every input job received (new rtsp camera stream to be analyzed), the pipeline is recreated and restarted and we read the input frames from the appsink. However, everytime the pipeline is restarted, the memory usage of the application shoots up. I have attached the sample program. main2.cpp gstCapture.h gstCapture.cpp

I have also tried to create the pipeline dynamically, i.e to create each element at run time and link them and making sure to free each and every gstreamer resource at the end, but the mem leak observed there is even more.

GStreamer and its plugin versions are : v1.17 OS: Ubuntu 18.04 x86_64

Thanks

Suraj

 

 

IDEMIA Internal


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

gstCapture.cpp (8K) Download Attachment
gstCapture.h (1K) Download Attachment
main2.cpp (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: gStreamer memory leak observed when restarting the pipeline multiple times

Tim Müller
On Wed, 2020-07-29 at 12:21 +0000, SAMAL Suraj wrote:

Hi,

> I have a simple program which has the following pipeline:
>    rtspsrc ! decodebin ! videoconvert ! videorate ! appsink
> The pipeline is started using gst_parse_launch(). For every input job
> received (new rtsp camera stream to be analyzed), the pipeline is
> recreated and restarted and we read the input frames from the
> appsink. However, everytime the pipeline is restarted, the memory
> usage of the application shoots up. I have attached the sample
> program. main2.cpp gstCapture.h gstCapture.cpp
>
> GStreamer and its plugin versions are : v1.17 OS: Ubuntu 18.04 x86_64

Have you tried running it in valgrind with --leak-check=yes (look for
*.supp suppression files in gst*/tests/check).

You can also run your code with our leak tracer, like

 $ GST_TRACERS=leaks GST_DEBUG=GST_TRACER:7 ./yourapp

which will on gst_deinit() output a list of leaked objects/mini-objects
That might give you a hint as to what is leaked, if it's GStreamer
objects

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gStreamer memory leak observed when restarting the pipeline multiple times

surajketan
Hi Tim, Sorry for a late response. I only observed your reply today (for some
reason, your response didnt send me a email alert.)
I wanted to tell you, that this is just a smaller version of our original
program which also leaks memory.The memory usage of the program increases
when the pipeline gets restarted over and over again. We have tried valgrind
and gst tracer, and libasan as well, and none of them reported any issues
with the code. Even using GST_DEBUG and GST_DEBUG_DUMP_DOT_DIR  we saw that
the pipeline elements look ok and are destroyed each time  (however it
assigns newer name with each restart e.g rtspsrc1, rtspsrc2 and so on).

For this simple program, mem usage increases from 50 MB (when first time it
creates the pipeline) to about 100MB (on 50th restart). Any suggestions?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel