https://gstreamer.freedesktop.org/documentation/additional/design/tracing.html?gi-language=c#traces-for-buffer-flow-events-and-messages-in-trace-level

leaks

  • track creation/destruction of GstObject and GstMiniObject

  • log those which are still alive when app is exiting and raise an error if any

  • The tracer takes several parameters in a GstStructure like syntax (without the structure name):

    • check-refs (boolean): Whether to also track object ref and unref operations example: GST_TRACERS=leaks(check-refs=true) COMMAND
    • stack-traces-flags: Flags to use when generating stack trace (does not generate stack trace if not set), valid values are “full” to retrieve as much information as possible in the backtrace, or “none” for a simple backtrace (usually does not contain line number or source files). This may significantly increase memory consumption. (You can also set the GST_LEAKS_TRACER_STACK_TRACE environment variable for that).
    • filters: (string): A comma separated list of object types to trace (make sure to enclose in quotation marks)

Run the leaks tracer on all GstProxyPad objects logging the references with full backtraces

GST_TRACERS=leaks(stack-traces-flags=full,filters=”GstProxyPad”,check-refs=true) COMMAND

Run the leaks tracer on all (mini)objects logging the references with less complete backtraces

GST_TRACERS=leaks(stack-traces-flags=fast,check-refs=true) COMMAND
  • If the GST_LEAKS_TRACER_SIG env variable is defined the tracer will handle the following UNIX signals:

  • SIGUSR1: log alive objects

  • SIGUSR2: create a checkpoint and print a list of objects created and destroyed since the previous checkpoint.

通过设置:

(1)

g_setenv ("GST_DEBUG", "GST_TRACER:7", TRUE);

g_setenv ("GST_TRACERS", "leaks", TRUE);

(2)需要执行

gst_deinit();

日志:

12-02 11:00:35.645   784  3733 V player+leaks: 0:00:20.844860161  :process_leaks[LINE:731]: <leakstracer0> start listing currently alive objects
12-02 11:00:35.645   784  3733 V player+GST_TRACER: 0:00:20.845114328  :[LINE:0]: object-alive, type-name=(string)GstTee, address=(gpointer)0xe5ee2ec0, description=(string)<audiotee>, ref-count=(uint)1, trace=(string);
12-02 11:00:35.646   784  3733 V player+GST_TRACER: 0:00:20.845575495  :[LINE:0]: object-alive, type-name=(string)GstPad, address=(gpointer)0xe6829470, description=(string)<audiotee:sink>, ref-count=(uint)2, trace=(string);
12-02 11:00:35.646   784  3733 V player+GST_TRACER: 0:00:20.845635245  :[LINE:0]: object-alive, type-name=(string)GstPad, address=(gpointer)0xe68135f8, description=(string)<'':sink>, ref-count=(uint)4, trace=(string);
12-02 11:00:35.646   784  3733 V player+GST_TRACER: 0:00:20.846074911  :[LINE:0]: object-alive, type-name=(string)GstBus, address=(gpointer)0xe8302948, description=(string)<bus4>, ref-count=(uint)2, trace=(string);
12-02 11:00:35.647   784  3733 V player+leaks: 0:00:20.846154245  :process_leaks[LINE:749]: <leakstracer0> done listing currently alive objects

Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐