Panzerschrek 20 hours ago

> The stack of each coroutine is fixed to a constant value. > #define COROUTINE_STACK_BYTESIZE 4096

That's the whole point of Go coroutines to have no such limitation on stack size. Go is able to grow stack if necessary. Implementing this in plain C is nearly to impossible. Exhausting 4kb of stack is pretty easy and in C it probably means silent data corruption.

I would suggest to allocate stack in a different way - ask OS for some region of virtual memory for it with lazy allocation of pages beyond the first one and with last page to be sentinel allowing detection of stack overflow.

  • gtutino 19 hours ago

    Yes I was already thinking about that and I'll surely implement it. Thanks!