This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Are mem_manager lib deprecated?

Hi all. In my application i use display. So i need to store many fonts and images, because of that there not a lot of free memory left.

In which cases usage of mem_manager lib are acceptable and in which are not?

Do i need to allocate hundreds of static arrays or instead use a few reusable? For example, if i work with strings of unknown length. I`ll get the strings from ble an then i need to put them in a queue, wait for some external flag and then send them using uart and this case may happened once in a week. I don`t need to store them for the future. Just a waste of memory if using static arrays.

Acceptable or not to use mem_manager in cases where i can use same memory ex. in int to send configuration and then in application for the strings? 

I can't believe there any case where you may get fragmentation or something else if you use memory diagnostic function and your head. I seen few topics where people not recommend to use dynamic memory allocation and the main argument was the fragmentation. So how i can have a fragmentation of arrays declared in background of mem_maneger? And how to get fragmentation if i write once then read once?

  • Hi,

    You can find the the documentation for mem manager, here. Not sure why it is not recommended to use dynamic memory allocation, guess you need to know what you are doing. Not sure I understand your use case completely but I think you could use the Memory object library here. And maybe also a ring buffer.

    There is a ring buffer implementation that might suite your BLE to UART use case. This is used by the nrf_log_frontend and nrf_cli_uart in SDK 15.3 in case you want to take a look.

Related