On Friday, 8 July 2016 at 20:35:05 UTC, 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.
But the size of fiber stack is fixed? When we call Fiber
constructor, the second parameter for ctor is stack size. If I
made a wrong guess and ask for too small stack then programm may
crash. If I ask for too large stack then I probably waste
resources. So, it would be nice if programmer will not forced to
make any wrong decisions about fiber's stack size.
Or maybe I'm wrong and I shouldn't care about stack size when I
create new fiber?