how to find where exactly is the leak?
Nicolas Dufresne
nicolas at ndufresne.ca
Wed Dec 2 18:21:19 UTC 2020
Le mercredi 02 décembre 2020 à 12:25 +0000, Jovic, Vladimir a écrit :
> Hi all,
>
> I managed to make the GST_TRACERS work, and now I am tracinga memory leak in
> my program using gstreamer libraries (1.16.2).
>
> Before executing my program, I set environment variables:
> export GST_DEBUG="GST_TRACER:7"
> export GST_TRACERS="leaks"
>
> What I got is this:
>
> 0:00:00.072938080 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracer.c:161:gst_tracer_register:<registry0> update existing feature
> 0x556e5719c0 (latency)
> 0:00:00.073084021 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracer.c:161:gst_tracer_register:<registry0> update existing feature
> 0x556e571a80 (log)
> 0:00:00.073141472 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracer.c:161:gst_tracer_register:<registry0> update existing feature
> 0x556e571b40 (rusage)
> 0:00:00.073198153 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracer.c:161:gst_tracer_register:<registry0> update existing feature
> 0x556e571c00 (stats)
> 0:00:00.073254993 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracer.c:161:gst_tracer_register:<registry0> update existing feature
> 0x556e571cc0 (leaks)
> 0:00:00.073491515 16736 0x556e76a900 TRACE GST_TRACER
> gsttracerrecord.c:111:gst_tracer_record_build_format: object-alive.class,
> type-name=(structure)"value\,\ type\=\(type\)gchararray\,\ related-
> to\=\(GstTracerValueScope\)GST_TRACER_VALUE_SCOPE_PROCESS\;",;
> 0:00:00.073565616 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracerrecord.c:125:gst_tracer_record_build_format: new format string:
> object-alive, type-name=(string)%s, address=(gpointer)%p,
> description=(string)%s, ref-count=(uint)%u, trace=(string)%s;
> 0:00:00.073715198 16736 0x556e76a900 TRACE GST_TRACER
> gsttracerrecord.c:111:gst_tracer_record_build_format: object-refings.class,
> ts=(structure)"value\,\ type\=\(type\)guint64\,\ related-
> to\=\(GstTracerValueScope\)GST_TRACER_VALUE_SCOPE_PROCESS\;", type-na;
> 0:00:00.073785908 16736 0x556e76a900 DEBUG GST_TRACER
> gsttracerrecord.c:125:gst_tracer_record_build_format: new format string:
> object-refings, ts=(guint64)%lu, type-name=(string)%s, address=(gpointer)%p,
> description=(string)%s, ref-count=(uint)%u, trace=(s;
>
> 0:00:23.151204309 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x7f8c06f000,
> description=(string)buffer: 0x7f8c06f000, pts 99:99:99.999999999, dts
> 99:99:99.999999999, dur 99:99:99.999999999, size 464;
> 0:00:23.151316520 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x7f78082000,
> description=(string)buffer: 0x7f78082000, pts 0:00:01.393507277, dts
> 0:00:01.426937281, dur 99:99:99.999999999, size 21131;
> 0:00:23.151366700 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x7f8800ed80,
> description=(string)buffer: 0x7f8800ed80, pts 99:99:99.999999999, dts
> 99:99:99.999999999, dur 99:99:99.999999999, size 464;
> 0:00:23.151415161 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x7f8c04b900,
> description=(string)buffer: 0x7f8c04b900, pts 99:99:99.999999999, dts
> 99:99:99.999999999, dur 99:99:99.999999999, size 464;
> 0:00:23.151463361 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x7f8c0825a0,
> description=(string)buffer: 0x7f8c0825a0, pts 99:99:99.999999999, dts
> 99:99:99.999999999, dur 99:99:99.999999999, size 464;
> 0:00:23.151510882 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x556e796120,
> description=(string)buffer: 0x556e796120, pts 99:99:99.999999999, dts
> 99:99:99.999999999, dur 99:99:99.999999999, size 464;
> 0:00:23.151558922 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x556e796360,
> description=(string)buffer: 0x556e796360, pts 0:00:01.390847621, dts
> 0:00:01.424449396, dur 99:99:99.999999999, size 21022;
> 0:00:23.151606003 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstBuffer, address=(gpointer)0x7f8800e7e0,
> description=(string)buffer: 0x7f8800e7e0, pts 99:99:99.999999999, dts
> 99:99:99.999999999, dur 99:99:99.999999999, size 464;
> 0:00:23.151653543 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f64002370,
> description=(string)video/x-raw, format=(string)I420, width=(int)640,
> height=(int)480, interlace-mode=(string)progressive, m;
> 0:00:23.151705104 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f880051e0,
> description=(string)video/x-raw, format=(string)I420, width=(int)640,
> height=(int)480, interlace-mode=(string)progressive, m;
> 0:00:23.485094218 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f7c5d3820,
> description=(string)0x7f7c5d3820, ref-count=(uint)1, trace=(string);
> 0:00:23.485145939 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f7c00edc0,
> description=(string)0x7f7c00edc0, ref-count=(uint)1, trace=(string);
> 0:00:23.485190529 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f7c974e90,
> description=(string)0x7f7c974e90, ref-count=(uint)1, trace=(string);
> 0:00:23.485235569 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f7c771ef0,
> description=(string)0x7f7c771ef0, ref-count=(uint)1, trace=(string);
> 0:00:23.485280600 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f883b62e0,
> description=(string)0x7f883b62e0, ref-count=(uint)1, trace=(string);
> 0:00:23.485324730 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f8867fbe0,
> description=(string)0x7f8867fbe0, ref-count=(uint)1, trace=(string);
> 0:00:23.485369021 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f7c1afc30,
> description=(string)0x7f7c1afc30, ref-count=(uint)1, trace=(string);
> 0:00:23.485414001 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstMemory, address=(gpointer)0x7f8812c000,
> description=(string)0x7f8812c000, ref-count=(uint)1, trace=(string);
> 0:00:23.485458652 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstVideoBufferPool,
> address=(gpointer)0x7f88085850, description=(string)<videobufferpool70>, ref-
> count=(uint)1, trace=(string);
> 0:00:23.485503292 16736 0x556e76a900 TRACE GST_TRACER :0::
> object-alive, type-name=(string)GstVideoBufferPool,
> address=(gpointer)0x7f88084f90, description=(string)<videobufferpool116>, ref-
> count=(uint)1, trace=(string);
If you look at the leaks, you got dome caps being leaked and two buffer pool. I
think the buffer pools are the one holding the GstBuffer and the GstMemory. As
the stack trace support is heavy, best is to combine with filters.
A good filter could be:
GST_TRACERS='leaks(filters="GstVideoBufferPool",stack-traces-flags=full)'
Of course that will only work if you have included libunwind support in your
GStreamer build, most distribution do.
Create from doc:
https://gstreamer.freedesktop.org/documentation/coretracers/leaks.html?gi-language=c#leaks-page
> ** (gst_memory_leak:16736): WARNING **: 12:00:57.071: Leaks detected
>
>
> So, it detected a memory leak, with some informations, but it doesn't say
> where exactly. The "trace" field is aways empty.
> What do I need to do to find the source of the leak?
>
> I tried setting this:
> export GST_DEBUG="GST_TRACER:7,GST_BUFFER*:7"
> and I got 40 Mb log, but it didn't say where the leak is. I can see that the
> last call to one of leaked buffers was to actually release it:
> 0:00:16.944182828 [332m19945[00m 0x7f64001ad0 [33;01mLOG [00m
> [00;01;42m GST_BUFFER gstbuffer.c:750:_gst_buffer_dispose:[00m
> release 0x7f6c009b40 to pool 0x7f7408c6f0
>
> Cheers,
> Vladimir Jovic
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list