memory leak generated by audiotestsrc

Charlie Laub charleslaub at sbcglobal.net
Sat Feb 10 00:43:54 UTC 2018


Hi Sean,

I experimented with the pipeline's source and sink elements like you suggested. I found some interesting behavior. First, for reference here is the pipeline that works without problems:

gst-launch-1.0 -v \
alsasrc device="hw:1,0" ! audio/x-raw,format=S32LE,rate=96000 ! deinterleave name=d \
d.src_0 ! tee name=t0 \
d.src_1 ! tee name=t1 \
t0. ! tee name=audio_silence \
audio_silence. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-90 ! "audio/x-raw,channel-mask=(bitmask)0x4" ! i.sink_0   \
audio_silence. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-90 ! "audio/x-raw,channel-mask=(bitmask)0x8" ! i.sink_1   \
audio_silence. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-90 ! "audio/x-raw,channel-mask=(bitmask)0x1" ! i.sink_2   \
audio_silence. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-90 ! "audio/x-raw,channel-mask=(bitmask)0x2" ! i.sink_3   \
t0. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-20 ! ladspa-acdf-so-acdf type=0 gain=10 ! "audio/x-raw,channel-mask=(bitmask)0x400" ! i.sink_4   \
t1. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-20 ! ladspa-acdf-so-acdf type=0 gain=10 ! "audio/x-raw,channel-mask=(bitmask)0x800" ! i.sink_5   \
audio_silence. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-90 ! "audio/x-raw,channel-mask=(bitmask)0x10" ! i.sink_6   \
audio_silence. ! queue ! audioconvert ! ladspa-acdf-so-acdf type=0 gain=-90 ! "audio/x-raw,channel-mask=(bitmask)0x20" ! i.sink_7   \
interleave name=i ! audioconvert ! audio/x-raw,format=S32LE ! alsasink device="hw:1,0"


I modified the pipeline for testing as follows:

TEST 1. 
source = audiotestsrc wave=silence 
sink = fakesink
RESULT: Consumed about 50% CPU utilization (25x times higher than is should be) compared to the pipeline using alsasrc and alsasink and leaked memory but at a MUCH FASTER RATE than previously reported (maybe 25 times faster)? I have to quickly kill the process because after 10 seconds it is already using over 1GB of memory and climbing fast, e.g. 100+MB/sec!

TEST 2: 
source = audiotestsrc 
sink = fakesink
RESULT: Consumed about 50% CPU utilization (25x times higher than is should be) compared to the pipeline using alsasrc and alsasink but did NOT leak memory.

TEST 3. 
source = audiotestsrc wave=silence 
sink = alsasink device="null'
RESULT: More or less exactly the same as for TEST 1. 

TEST 4. 
source = audiotestsrc wave=silence 
sink = alsasink device="hw:1,0'
RESULT: I set the alsasink to again point at my computer's onboard sound codec. This leaked memory at around 4-5MB per second, which is faster than what I originally reported with both alsa source and sinks in use. CPU utilization was normal (2%).

TEST 5. 
source = audiotestsrc 
sink = alsasink device="null'
RESULT: Similar to TEST 2 except that CPU utilization increased to 70+% with one core out of 4 saturated at 100% utilization. No memory leak.

TEST 6. 
source = alsasrc device="hw:1,0"
sink = alsasink device="null" provide-clock=false
RESULT: Here I tried to force the pipeline to use the system clock or the source clock. This did not leak memory but pinned one CPU at 100% utilization and used a bit of another (28% overall CPU utilization). 

My wild guesses about what is happening include:
A. Setting wave-silence causes memory leaks
B. When fakesink or alsa device=null is combined with audiotestsrc there is a problem with the clock for the pipeline and it is almost free running or the clock is 25 times faster than it should be. I have caps right after the source indicating the desired rate (96000 Hz), but maybe this is not working? The debug output shows rate=96000...

Thanks for looking into this.

-Charlie






More information about the gstreamer-devel mailing list