Memory Leak with RTSP Server

Dwight Kulkarni dwight at
Tue Dec 14 15:08:12 UTC 2021

Hello everyone,

I am facing a strange behavior with my RTSP server setup and was hoping for
any assistance.

The issue is that I have an RTSP Server that starts on a thread.

When no VLC client is connected, I check the memory and it is stable.

When I connect the VLC client there is an initial jump in the memory usage
of about 20-30 mb.

Thereafter, the memory usage climbs by a few megs every 10-20 seconds and
stabilizes around 80 mb.

The problem seems to occur after I disconnect the VLC client by closing the

The used up memory from the VLC connection is not released. If I try to
connect with the VLC Client again, it gives me a segmentation fault and
breaks the application. The message I get is:

*(server:2331): GStreamer-CRITICAL **: 14:54:31.771: Trying to dispose
element pipeline0, but it is in READY instead of the NULL state.You need to
explicitly set elements to the NULL state beforedropping the final
reference, to allow them to clean up.This problem may also be caused by a
refcounting bug in theapplication or some element.Segmentation fault*

It seems as if I need to dispose something which I am not presently doing
when the client is disconnected. Maybe I need to stop the pipeline when no
more clients are present ?

Please see attached code.


Dwight Kulkarni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtsp_server_thread_function
Type: application/octet-stream
Size: 5583 bytes
Desc: not available
URL: <>

More information about the gstreamer-devel mailing list