Reputation: 1040
Recently I wrote a C-Application for a Microblaze and I used uC/OS-II. uC/OS-II offers memory pools to allocate and deallocate blocks of memory with fixed size. I'm now writing a C-Application for an STM32 where I use this time FreeRTOS. It seems like FreeRTOS doesn't offer the same mechanism or did I miss something? I think the five heap implementations are not what I am looking for.
If there are actually no memory pools, is there any specific reason why?
Upvotes: 2
Views: 3862
Reputation: 3236
The original version of FreeRTOS used memory pools. However it was found that users struggled to dimension the pools, which led to a constant stream of support requests. Also, as the original versions of FreeRTOS were intended for very RAM constrained systems, it was found that the RAM wasted by the use of oversized pools was not acceptable. It was therefore decided to move memory allocation to the portable layer, on the understanding that no one scheme is suitable for more than a subset of applications, and allowing users to provide their own scheme. As you mention, there are five example implementations provided, which cover nearly all applications, but if you absolutely must use a memory pool implementation, then you can easily add this by providing your own pvPortMalloc() and vPortFree() implementations (memory pools being one of the easier ones to implement).
Also note that, in FreeRTOS V9, you need not have any memory allocation scheme as everything can be statically allocated.
Upvotes: 1