C memory management functions
Opened this issue · 3 comments
Usually in embedded uC it is not recommended to use low-level memory management functions.
Can you think of possible workarounds, including checking if there's enough free memory to run dynamic allocation?
You're right that allocating dynamic memory in embedded systems is generally not a good idea. As far as I'm aware you're relatively safe as long as you don't free up memory that's been allocated (causing fragmentation).
That said it's possible to adapt the library to define a constant number of transitions.
Have you noticed anything funky?
Up to now no, I would like to use this FSM within FreeRTOS applied to robotics so I am afraid there might be stability issues when dealing with dynamic memory allocations.
Just to be sure, I would add a method to statically initiate the fsm object without using malloc and similar.
Unless your dynamically changing your state machine (not sure what the use case would be for that) you should be building your state machine in setup
. After that no memory allocation is done, so you should be fine.