Dynamic Memory Allocation in nrf52840

Hi,

I am using nrf52840 with SDK 16.0. We wanted to dynamically allocate 49kb and 75kb of memory. Is there is any risk while de-allocating? Is it recommended to use the DMA memory?

If so, which Api is best to use? Please give us information on this ASAP.

Thank you,

Shreya

  • Hi,

     

    There are no generic DMA channels on nRF52-series devices.

    We wanted to dynamically allocate 49kb and 75kb of memory.

    Dynamic memory allocations can be many things, for instance the usage of stdlib.h malloc(). This requires that you setup a HEAP area, done by adjusting  ASM flag "__HEAP_SIZE".

    Is there is any risk while de-allocating?

    Yes, if you search for "malloc heap fragmentation" on your favorite search engine, you can see the different side-effects.

    Kind regards,

    Håkon

Related