leaks

This tracing module tracks the lifetimes of GstObject and GstMiniObject objects and prints a list of leaks to the debug log under GST_TRACER:7 when gst_deinit is called, and also prints a g_warning.

Starting with GStreamer 1.18, you can also use GObject action signals on the tracer object to fetch leak information. Use gst_tracing_get_active_tracers to get a list of all active tracers and find the right one by name.

If the GST_LEAKS_TRACER_SIG env variable is defined, you can use the following POSIX signals to interact with the leaks tracer:

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

You can activate this tracer in the usual way by adding the string 'leaks' to the environment variable GST_TRACERS. Such as: GST_TRACERS=leaks

Note that the values are separated by semicolon (;), such as: GST_TRACERS=leaks;latency, and multiple instances of the same tracer can be active at the same time.

Parameters can also be passed to each tracer. The leaks tracer currently accepts five params:

  1. filters: (string) to filter which objects to record
  2. check-refs: (boolean) whether to record every location where a leaked object was reffed and unreffed
  3. stack-traces-flags: (string) full or none; see: GstStackTraceFlags
  4. name: (string) set a name for the tracer object itself
  5. log-leaks-on-deinit: (boolean) whether to report all leaks on gst_deinit by printing them in the debug log; "true" by default

Examples:

GST_TRACERS='leaks(filters="GstEvent,GstMessage",stack-traces-flags=none)'
GST_TRACERS='leaks(filters="GstBuffer",stack-traces-flags=full,check-refs=true);leaks(name=all-leaks)'

The results of the search are