out of memory issue

Alex Roberts arob109 at gmail.com
Wed Jul 21 20:06:26 CEST 2021


Hello,

I am developing a dummy codec to interface with an 8-channel, 24-bit
ADC. I've got it working on an NXP imx8m through the fsl_sai driver on
kernel 5.4.85. I can capture all 8 channels at varying sample rates
using arecord, and I've verified correct data capture via opening the
resulting .wav file in Audacity. The problem I am having is that
occasionally, upon starting arecord - after a fresh power cycle - I
get an out of memory error. Other times I get an out of memory after a
non-deterministic period of capture. Starting capture again also
reports out of memory, but if I wait several minutes and start capture
it will start recording again. A power cycle usually helps, but as
stated earlier, not 100% of the time.

I'm trying to track down where the oom error is coming from, but
haven't had much luck. My colleague tried running arecord with
valgrind to check for memory leaks and nothing of note was observed.
My suspicion is there's something going on with allocated memory for
DMA, like fragmentation starts to happen and it can't get a contiguous
region for operation. Reserving a large pool - either via device tree
or boot cmd arguments in the bootoader - did not seem to help.

Another thought is that it's a boundary/alignment issue due to the
24-bit data, and the error is the result of trying to allocate a chunk
of memory for DMA that doesn't align.

I'm very new to ALSA dev with some exposure to kernel dev in general,
so please correct me if I'm wrong or completely mis-understanding
something.

Any suggestions on where I should / how I can debug this memory error?

Thanks,
Alex.


More information about the Alsa-devel mailing list