Memory leak in main (1.21), FLAC module suspected
For the record:
As discussed on IRC, here's a placeholder issue for a memory leak I'm experiencing with gstreamer 1.21, compiled directly from the main branch. Last commit fedb48c6, on May 14 2022.
I'm using gstreamer in my IceGStreamer project, an icecast source client I created. Up until 1.20.2 there was no significant RES increase when using it for days, ~115MB RES usage was normal. Ever since I started using main
, memory usage keeps increasing. RES was yesterday (after ~2 days of running) 250MB, and it is 306M now, after ~8hrs. VIRT values are also higher than before, although I wasn't following those closely. It's the first time I changed to main
compilation, so I can't tell at which point this memleak got introduced.
I suspect that the FLAC module is at fault, as other IceGStreamer instances that don't play (as much) .flac files, don't reflect the same increasingly expanding RES usage, although I see them consuming more over time. I also get weird artifacts in the log when FLAC playback starts:
60:49:12.719821448 95818 0x802c07c00 ERROR libav :0:: invalid sync code
60:49:12.719830054 95818 0x802c07c00 ERROR libav :0:: invalid frame header
60:49:12.719832378 95818 0x802c07c00 ERROR libav :0:: decode_frame() failed
60:49:12.720092488 95818 0x802c07c00 ERROR libav :0:: invalid sync code
60:49:12.720096084 95818 0x802c07c00 ERROR libav :0:: invalid frame header
60:49:12.720097678 95818 0x802c07c00 ERROR libav :0:: decode_frame() failed
60:49:12.720103919 95818 0x802c07c00 ERROR libav :0:: invalid sync code
60:49:12.720105823 95818 0x802c07c00 ERROR libav :0:: invalid frame header
60:49:12.720107336 95818 0x802c07c00 ERROR libav :0:: decode_frame() failed
Suggestions on how to debug this problem, copied over from IRC, for later reference (mostly for myself when I have time to tend to this):
perhaps you could run your code through valgrind --leak-check=yes (with the various .supp suppression files from gstreamer repos) or valgrind heaptrack or you could try the GStreamer leak tracer to see if it's GStreamer objects that are being leaked
or any other C heap allocation tracing tool