AppSink consumes lot's of memory. How to control memory consumption?
Антон Шаров
sharov_am at mail.ru
Thu Sep 14 23:32:12 UTC 2023
Hi.
Consider following pipeline:
rtspsrc ! rtph264depay ! h264parse ! tee name=vi vi. ! queue ! splitmuxsink vi. ! queue ! avdec_h264 ! jpegenc ! apsink
Appsink config and NewSample handler is below. My problem is that it consumes lot’s of (unmanaged) memory.
There is no leak, it works ok, after .net GC run memory lower to normal values and then grows again. It looks like
saw-tooth. I’ve tried to limit max-buffers (set it to 100 or 1), drop = true but it seems that nothing works. Memory profiler shows smth like 30K instances of Gst.Memory holds 1.5Gb of unmanaged (in terms of .net) memory. Aftre GC collect, it seems to collect some of these instances and release some unmanaged memory (say it lowers 10 times). Again, there is no leeks, I just want to lower memory consumption of appsink element.
Any ideas how to achieve that?
Thanks in advance.
Appsink code:
var appSink = new AppSink("appsink_{CaptureConfig.CameraId}");
appSink.NewSample += AppSinkNewSample;
appSink.EmitSignals = true;
private void AppSinkNewSample(object o, NewSampleArgs args)
{
if (o is AppSink aps)
{
using (var sample = aps.PullSample())
{
using (var buf = sample.Buffer)
{
SomeStuff(buf);
}
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230915/24e065f8/attachment.htm>
More information about the gstreamer-devel
mailing list