> since it allocates memory for the coroutine state
Heap allocation is not required, just the default.
You can do static allocation if you wish, though it is a little more complicated than typical static allocation due to the relative unpredictability.