Oops, sorry I missed this email. Coroutines is a standard Lua library, included in the official code. More information here: http://www.lua.org/pil/9.1.html.
I haven't examined the internals of this library yet. It may indeed have excessive memory requirements, or it may be that the tests are pretty extreme and exhaustive. I will have to test a real-life application on an actual MCU, to see what is actually happening. But till now, Lua was very polite on my stacks. On Mon, Aug 29, 2022 at 12:57 AM Gregory Nutt <spudan...@gmail.com> wrote: > One thing that I found odd is the excessive stack usage of the coroutines > > library. > > On the simulator I had to set the stack to 1M. > > > > I am afraid that this specific library may not be usable on actual MCU > > systems... > > > > Is this a Linux library? > > I have seen this kind of stack usage a few time when code written for Linux > is ported to NuttX. Linux code sometimes allocates huge arrays on the > stack. This is harmless on Linux since the stack is virtualized and only > backed by RAM if actually used. But it can cause catastrophic memory usage > in an embedded system with a flat address space. >