This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What is Block memory allocator ?

Hi All,

Now i'm using peripheral - blinky project,and i saw the Block allocator module in the sdk_config.h.

Can anyone tell me what is the Block allocator module use for?

Best regards,

Kai

  • Hello Kai,

    Block allocator is used for opening up application implementation by offering dynamic memory allocations in systems. It is helpful to handle large objects as well.

    In the config file #define NRF_BALLOC_ENABLED sets as 1 to enable the Balloc module. https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__nrf__balloc.html?cp=8_5_4_6_11_4 

    Best Regards,
    Kazi Afroza Sultana
  • Hi Sultana,

    I'm not very sure what you mean.Do you have any example or teaching film.

    Best regards,

    Kai

  • Hello kai,

    I meant this block allocator is a module which enables dynamic memory allocation. We do not have any teaching film. I am trying to explaining you - 

    Say, there is a task of filling up an allocation request which consists locating a block of unused memory of sufficient size. Memory requests are satisfied by allocating portions from a large memory pool called the heap or free store (The heap is an area of RAM that represents the dynamic memory of the system. When one module does not need its allocated memory anymore, the developer should return it to the memory allocator so that it could be reused by some other module.)  

    For example: in the below figure we can see that there are 6 blocks of free memory available in first row.  In the second row, A B and C blocks are dynamically allocated. In the 3rd row we can see that the middle block is released or freed and other two memory blocks are used still. If any new module needs a free block as same size of B then it can be used by that otherwise it would be free.

    Here is the link of block allocator libraries used in nRF5 SDK Nordic Semiconductor Infocenter  which enables the application to create a fixed-size block pool in RAM. Apart from blinky example , it is also used in secure bootloader uart example, the function uart_dfu_transport_init() in nRF5_SDK_17.1.0_ddde560\components\libraries\bootloader\serial_dfu\nrf_dfu_serial_uart.c . One more thing, nrf_balloc is not used for anything directly in blinky example, but it is used by nrf_log module to allocate buffers, etc. The logger module is included in blinky example. 

    I hope it helps.

    Best Regards,

    Kazi Afroza Sultana

  • Hi Sultana,

    I got it,thank you very much!

    Best regards,

    Kai

  • Hello Kai,

    You are welcome.

    Best Regards,

    Kazi Afroza Sultana

Related