To simplify the use of REXIS, REXIS uses dynamic memory allocation for task structures, inter-process communication and other kernel needs. Dynamic memory allocation is often discouraged in embedded system uses. However:
· While dynamic memory allocation does require some space (and time) overhead, the space overhead is minimal comparing to the actual amount of space used.
· Some RTOSes require pre-allocated space for stacks and task structures, but these are tedious and limiting. The only advantage of that approach is that the space usage is known statically and the linker will complain if too much space is allocated in the program. When using REXIS, an out-of-memory situation will quickly be apparent in even the most rudimentary testing scenarios, so having a statically known size would not really be an advantage either.
· Many of the middleware stacks, such as lwIP, use dynamic memory for buffers and other structures, so dynamic memory usage is unavoidable.
REXIS implements dynamic memory allocation using a best-fit always-merge allocator to lessen memory fragmentation. It places no arbitrary limits on the number of tasks or task priorities, except as constrained by the memory size, and allows dynamic task creation and deletion. This approach allows REXIS to scale up and down, except in the most memory-constrained situations.