On Fri, 08 Jul 2016 22:35:05 +0200, Martin Nowak wrote: > On 07/08/2016 07:45 AM, ikod wrote: >> Correct me if I'm wrong, but in D fibers allocate stack statically, so >> we have to preallocate large stacks. >> >> If yes - can we allocate stack frames on demand from some non-GC area? > > Fiber stacks are just mapped virtual memory pages that the kernel only > backs with physical memory when they're actually used. So they already > are allocated on demand.
The downside is that it's difficult to release that memory. On the other hand, Go had a lot of problems with its implementation in part because it released memory. At some point you start telling users: if you want a fiber that does a huge recursion, dispose of it when you're done. It's cheap enough to create another fiber later.
