how to find where exactly is the leak?
Jovic, Vladimir
vladimir.jovic at ifm.com
Wed Dec 2 12:25:25 UTC 2020
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);
** (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
More information about the gstreamer-devel
mailing list