Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c56046b
alloc: Add rmalloc_align() function
Sep 4, 2025
aa733f5
cmocka: Prepare cmocka tests for rmalloc and rmalloc_align
Sep 4, 2025
f271764
testbench: library: Prepare for rmalloc_align() usage
Sep 4, 2025
8461592
modules: alloc API: Use rmalloc() instead of rbmalloc()
Sep 3, 2025
c570480
modules: Better mod_alloc_align() failure prints
Sep 2, 2025
62009db
ipc4: helper: Print module IDs as hex
Sep 2, 2025
e278ee7
alloc: Add Kconfig option to call rballoc_align() from mod_alloc_align()
Sep 10, 2025
389e7e1
modules: mod_alloc: mod_alloc size and alignment parameter to size_t
Sep 12, 2025
a61b5dc
Audio: Aria: All memory allocations through module API
Aug 7, 2025
ee851e7
Audio: ASRC: Memory, blob, and fast_get allocs to module API
Aug 7, 2025
fff5be8
Audio: Copier: All memory allocations through module API
Aug 7, 2025
cb10e0e
audio: copier: Fix resource leak from DMA sync code error handling
Sep 5, 2025
be31380
Audio: crossover: All memory allocations through module API
Aug 11, 2025
eafbb0b
Audio: multiband_drc: Memory, blob, and fast_get allocs to module API
Aug 13, 2025
8ec2c91
Audio: DRC: Memory, blob, and fast_get allocs to module API
Aug 13, 2025
f9ad9a0
Audio: FIR: Memory, blob, and fast_get allocs to module API
Aug 19, 2025
2609ad1
Audio: IIR: Memory, blob, and fast_get allocs to module API
Aug 19, 2025
cde0329
Audio: Google ctc: Memory, blob, and fast_get allocs to module API
Aug 19, 2025
184fbf9
Audio: Google rtc: Memory, blob, and fast_get allocs to module API
Aug 19, 2025
97bfd63
Audio: igo_nr: Memory, blob, and fast_get allocs to module API
Aug 19, 2025
c9fb54e
Math: Make mod_alloc() versions of all heap using functions
Aug 21, 2025
6ea7c92
Audio: mfcc: Memory, blob, and fast_get allocs to module API
Aug 21, 2025
01402f9
cmocka: Add mocks for mod_alloc(), mod_zalloc(), and mod_free()
Aug 22, 2025
b914c03
cmocka: math: Test using module memory API math function
Aug 23, 2025
959d73e
Math: Remove directly heap using math functions
Aug 24, 2025
7a0c549
audio: mixer: Memory, blob, and fast_get allocs to module API
Aug 24, 2025
f49324b
Audio: mixin_mixout: Memory, blob, and fast_get allocs to module API
Aug 24, 2025
6c84a6b
Audio: Mux: Memory, blob, and fast_get allocs to module API
Aug 24, 2025
5a5493f
Audio: NXP: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
40090f1
Audio: RTNR: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
58c572a
Audio: Selector: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
0071dd7
Audio: TDFB: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
1d298d9
Audio: Template_comp: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
ec02d5c
modules: tensorflow: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
dae1251
Audio: up_down_mixer: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
4ae6dc4
audio: volume: Memory, blob, and fast_get allocs to module API
Aug 25, 2025
6f236f3
Math: auditory: Add mod_psy_free_mel_filterbank()
Aug 26, 2025
3468c8b
cmocka: math: auditiory: Fix memory leaks
Aug 26, 2025
86d31fd
cmocka: math: fft: Fix memory leaks
Aug 26, 2025
4982e26
cmocka: math: matrix: Fix memory leaks
Aug 26, 2025
bf7340d
Math: DCT: Add mod_dct_free_16()
Aug 26, 2025
59b2343
cmocka: math: dct: Fix memory leaks
Aug 26, 2025
66153c1
cmocka: module_adapter_test: Fix memory freeing error
Aug 26, 2025
f5db2fc
cmocka: volume: Fix memory leaks
Aug 26, 2025
66914d3
cmocka: mux_copy: Fix memory leaks
Aug 26, 2025
865c461
cmocka: demux_copy: Fix memory leaks
Aug 26, 2025
65b1e8b
cmocka: pipeline: Fix memory leaks
Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions posix/include/rtos/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@
* Allocates memory block.
* @param flags Flags, see SOF_MEM_FLAG_...
* @param bytes Size in bytes.
* @param alignment Alignment in bytes.
* @return Pointer to the allocated memory or NULL if failed.
*/
void *rmalloc_align(uint32_t flags, size_t bytes,
uint32_t alignment);

/**
* Similar to rmalloc_align(), but no alignment can be specified.
*/
void *rmalloc(uint32_t flags, size_t bytes);

/**
Expand Down
10 changes: 2 additions & 8 deletions src/audio/aria/aria.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <sof/audio/pipeline.h>
#include <rtos/panic.h>
#include <sof/ipc/msg.h>
#include <rtos/alloc.h>
#include <rtos/cache.h>
#include <rtos/init.h>
#include <sof/lib/notifier.h>
Expand Down Expand Up @@ -126,7 +125,7 @@ static int aria_init(struct processing_module *mod)
list_init(&dev->bsource_list);
list_init(&dev->bsink_list);

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
cd = mod_zalloc(mod, sizeof(*cd));
if (!cd) {
return -ENOMEM;
}
Expand All @@ -145,10 +144,9 @@ static int aria_init(struct processing_module *mod)
}
mod_data->private = cd;

buf = rballoc(SOF_MEM_FLAG_USER, req_mem);
buf = mod_alloc(mod, req_mem);

if (!buf) {
rfree(cd);
comp_err(dev, "allocation failed for size %d", req_mem);
return -ENOMEM;
}
Expand All @@ -158,10 +156,6 @@ static int aria_init(struct processing_module *mod)

static int aria_free(struct processing_module *mod)
{
struct aria_data *cd = module_get_private_data(mod);

rfree(cd->data_addr);
rfree(cd);
return 0;
}

Expand Down
47 changes: 19 additions & 28 deletions src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <sof/audio/ipc-config.h>
#include <rtos/panic.h>
#include <sof/ipc/msg.h>
#include <rtos/alloc.h>
#include <rtos/init.h>
#include <sof/lib/uuid.h>
#include <sof/math/numbers.h>
Expand Down Expand Up @@ -217,7 +216,7 @@ static int asrc_init(struct processing_module *mod)
return -EINVAL;
}

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
cd = mod_alloc(mod, sizeof(*cd));
if (!cd)
return -ENOMEM;

Expand All @@ -242,7 +241,7 @@ static int asrc_init(struct processing_module *mod)
return 0;
}

static int asrc_initialize_buffers(struct asrc_farrow *src_obj)
static int asrc_initialize_buffers(struct processing_module *mod, struct asrc_farrow *src_obj)
{
int32_t *buf_32;
int16_t *buf_16;
Expand All @@ -261,7 +260,7 @@ static int asrc_initialize_buffers(struct asrc_farrow *src_obj)
buffer_size = src_obj->buffer_length * sizeof(int32_t);

for (ch = 0; ch < src_obj->num_channels; ch++) {
buf_32 = rzalloc(SOF_MEM_FLAG_USER, buffer_size);
buf_32 = mod_zalloc(mod, buffer_size);

if (!buf_32)
return -ENOMEM;
Expand All @@ -272,7 +271,7 @@ static int asrc_initialize_buffers(struct asrc_farrow *src_obj)
buffer_size = src_obj->buffer_length * sizeof(int16_t);

for (ch = 0; ch < src_obj->num_channels; ch++) {
buf_16 = rzalloc(SOF_MEM_FLAG_USER, buffer_size);
buf_16 = mod_zalloc(mod, buffer_size);

if (!buf_16)
return -ENOMEM;
Expand All @@ -284,7 +283,7 @@ static int asrc_initialize_buffers(struct asrc_farrow *src_obj)
return 0;
}

static void asrc_release_buffers(struct asrc_farrow *src_obj)
static void asrc_release_buffers(struct processing_module *mod, struct asrc_farrow *src_obj)
{
int32_t *buf_32;
int16_t *buf_16;
Expand All @@ -299,7 +298,7 @@ static void asrc_release_buffers(struct asrc_farrow *src_obj)

if (buf_32) {
src_obj->ring_buffers32[ch] = NULL;
rfree(buf_32);
mod_free(mod, buf_32);
}
}
else
Expand All @@ -308,23 +307,17 @@ static void asrc_release_buffers(struct asrc_farrow *src_obj)

if (buf_16) {
src_obj->ring_buffers16[ch] = NULL;
rfree(buf_16);
mod_free(mod, buf_16);
}
}
}

static int asrc_free(struct processing_module *mod)
{
struct comp_data *cd = module_get_private_data(mod);
struct comp_dev *dev = mod->dev;

comp_dbg(dev, "asrc_free()");

rfree(cd->buf);
asrc_release_buffers(cd->asrc_obj);
asrc_free_polyphase_filter(cd->asrc_obj);
rfree(cd->asrc_obj);
rfree(cd);
return 0;
}

Expand Down Expand Up @@ -614,8 +607,7 @@ static int asrc_prepare(struct processing_module *mod,
cd->buf_size = (cd->source_frames_max + cd->sink_frames_max) *
frame_bytes;

cd->buf = rzalloc(SOF_MEM_FLAG_USER,
cd->buf_size);
cd->buf = mod_zalloc(mod, cd->buf_size);
if (!cd->buf) {
cd->buf_size = 0;
comp_err(dev, "asrc_prepare(), allocation fail for size %d",
Expand All @@ -632,16 +624,15 @@ static int asrc_prepare(struct processing_module *mod,

/* Get required size and allocate memory for ASRC */
sample_bits = sample_bytes * 8;
ret = asrc_get_required_size(dev, &cd->asrc_size,
ret = asrc_get_required_size(mod, &cd->asrc_size,
audio_stream_get_channels(&sourceb->stream),
sample_bits);
if (ret) {
comp_err(dev, "asrc_prepare(), get_required_size_bytes failed");
goto err_free_buf;
}

cd->asrc_obj = rzalloc(SOF_MEM_FLAG_USER,
cd->asrc_size);
cd->asrc_obj = mod_zalloc(mod, cd->asrc_size);
if (!cd->asrc_obj) {
comp_err(dev, "asrc_prepare(), allocation fail for size %d",
cd->asrc_size);
Expand All @@ -659,7 +650,7 @@ static int asrc_prepare(struct processing_module *mod,
fs_sec = cd->source_rate;
}

ret = asrc_initialise(dev, cd->asrc_obj, audio_stream_get_channels(&sourceb->stream),
ret = asrc_initialise(mod, cd->asrc_obj, audio_stream_get_channels(&sourceb->stream),
fs_prim, fs_sec,
ASRC_IOF_INTERLEAVED, ASRC_IOF_INTERLEAVED,
ASRC_BM_LINEAR, cd->frames, sample_bits,
Expand All @@ -670,7 +661,7 @@ static int asrc_prepare(struct processing_module *mod,
}

/* Allocate ring buffers */
ret = asrc_initialize_buffers(cd->asrc_obj);
ret = asrc_initialize_buffers(mod, cd->asrc_obj);

/* check for errors */
if (ret) {
Expand Down Expand Up @@ -698,12 +689,12 @@ static int asrc_prepare(struct processing_module *mod,
return 0;

err_free_asrc:
asrc_release_buffers(cd->asrc_obj);
rfree(cd->asrc_obj);
asrc_release_buffers(mod, cd->asrc_obj);
mod_free(mod, cd->asrc_obj);
cd->asrc_obj = NULL;

err_free_buf:
rfree(cd->buf);
mod_free(mod, cd->buf);
cd->buf = NULL;

err:
Expand Down Expand Up @@ -865,10 +856,10 @@ static int asrc_reset(struct processing_module *mod)
asrc_dai_stop_timestamp(cd);

/* Free the allocations those were done in prepare() */
asrc_release_buffers(cd->asrc_obj);
asrc_free_polyphase_filter(cd->asrc_obj);
rfree(cd->asrc_obj);
rfree(cd->buf);
asrc_release_buffers(mod, cd->asrc_obj);
asrc_free_polyphase_filter(mod, cd->asrc_obj);
mod_free(mod, cd->asrc_obj);
mod_free(mod, cd->buf);
cd->asrc_obj = NULL;
cd->buf = NULL;

Expand Down
Loading
Loading