We are using the μC/OS-III RTOS of Micrium with a RX62N of Renesas.
We built a system where we have to dynamicly alloc and free data. We found out the functions malloc() and free() are not working well with the RTOS. However the RTOS has a custom function for this; the Mem_HeapAlloc() function. This function allocates some memory of the RTOS' made 'heap'. Problem is that it does not have a free function, probably because everything goes into a heap pool.
In the RTOS it is also possible to make a pool. Problem of this pool is that all the containing blocks need to be the same size. Since we are allocating and freeing different sizes, this is not a good solution for us.
We found a document which describes the memory RTOS functions HERE Chapter 4 describes the functions.
Does somebody have any idea how we could fix this problem ?
Some solutions we allready had
- Make all the blocks sizes the same as the biggest allocation. We have a lot of overhead since the smallest and biggest allocation differ a lot.
- Don't do a free. This is no solution, there will be a memory leak.
Hope somebody can help us. If something is not clear, please ask me
Thanks in advance