[opus] Global stack on Cortex-M4

Jean-Marc Valin jmvalin at jmvalin.ca
Wed Oct 18 21:32:14 UTC 2017

On 18/10/17 04:40 PM, Eric wrote:
>          -D'opus_alloc(x)=NULL' -D'opus_free(x)=NULL'
> Secondly; With the "overide" directives above no dynamic memory
> allocation is supposed to happen. However, the following call chain
> (obviously)  cause a crash:

Presumably, you're using the init() calls and not the create() calls
(which require allocation). In that case, you'll want to also define
OVERRIDE_OPUS_ALLOC_SCRATCH and have opus_alloc_scratch() return a
buffer where to put the stack (as Tim pointed out). Otherwise you can
use alloca() or VLAs, but you have to somehow give Opus some way to get
memory. With the above options, you're basically preventing Opus from
having any stack space.



More information about the opus mailing list