简体   繁体   English

Gstreamer元素内存泄漏

[英]Gstreamer elements memory leak

How to find memory leak problem in the gstreamer elements/plugins? 如何在gstreamer元素/插件中查找内存泄漏问题? How to analyse the gst refcount for memory/object leak/refcount? 如何分析GST引用计数的内存/对象泄漏/引用计数? any examples? 有什么例子吗? I am using appsrc and appsink to push and pull buffer to and from the gstreamer pipeline. 我正在使用appsrc和appsink在gstreamer管道之间来回推送缓冲区。 Seems like there is some memory issue with these elements. 这些元素似乎存在一些内存问题。 I have live source which feeds data to pipeline, typically what are the properties to be set on appsrc and appsink for the live source? 我有实时源,它将数据馈送到管道,通常在实时源的appsrc和appsink上设置哪些属性? Thanks-opensid 感谢opensid

You can use tools like valgrind (memcheck) or asan (address sanitizer) to check for such issues. 您可以使用valgrind(memcheck)或asan(address sanitizer)之类的工具来检查此类问题。 Refcount issues are tricky to find. Refcount问题很难找到。

If you're using the AppSrc sample then there's a rather easy solution which is to wrap the Gst.Buffer allocation in a using statement. 如果您使用的是AppSrc示例,那么有一个相当简单的解决方案,即将Gst.Buffer分配包装在using语句中。

EG Change the following method EG更改以下方法

static void PushAppData (object o, Gst.App.NeedDataArgs args) {
  ulong mseconds = 0;
  if (appsrc.Clock != null)
    mseconds = appsrc.Clock.Time / Clock.MSecond;
  Gst.Buffer buffer = DrawData (mseconds);
  appsrc.PushBuffer (buffer);
}

to this 对此

static void PushAppData (object o, Gst.App.NeedDataArgs args) {
  ulong mseconds = 0;
  if (appsrc.Clock != null)
    mseconds = appsrc.Clock.Time / Clock.MSecond;
  using(Gst.Buffer buffer = DrawData (mseconds))
    appsrc.PushBuffer (buffer);
}

Previously for my this sample would crash in <30 seconds. 以前,对于我来说,此示例将在<30秒内崩溃。 Now it runs until I kill it. 现在它运行直到我将其杀死。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM