There is no threshold or a way to decide where malloc will get its memory from.
The memory available for the allocator is both the internal (SRAM) and
external SPIRAM, if your request cannot be honored from the internal
memory then the allocator will look into the external memory (but it's
not deterministic, it depends on the state of the heap.)
In a way you can say that the threshold to choose external memory is
the size + 1 of the available internal memory.

There is also a way to use part of SRAM as a separate heap.  This can
only be used inside the kernel with a specific API and malloc will not
have access to it.

On Mon, Dec 19, 2022 at 2:27 PM Victor Benso <vbe...@gmail.com> wrote:
>
> Hello,
>
> I'm running NuttX on an ESP32 with SPIRAM, when using malloc in an app,
> what is the threshold, if any,  used in the decision of allocating internal
> or external memory?
> Is this a config parameter?
> Is there a proper way to control which region (internal or external) a
> specific allocation will happen?
>
>
> Victor A. P. Benso
>
> (47) 999-229-599
> (65) 999-186-147

Reply via email to