[Mono-dev] Monoco, couroutines and Mono.
james at mansionfamily.plus.com
Thu Apr 16 15:26:55 EDT 2009
Tomi Valkeinen wrote:
> The stack must be able to grow, otherwise we may run out of stack. If
> we want to manage a proper stack for each continuation, we need to
> allocate it in page sized chunks, and we need the guard pages. This
> would increase the required memory needed for each continuation quite
> a bit.
Indeed, but code that is specialised to use continuations can also be
specialised to avoid recursion and large stack-resident objects. I can
do that in C and C++ with coroutine and fibre systems, why do you think
its different in C#? To be honest, the stack growth issue is probably a
non-issue in practice.
> Also, the stack contains pointers to variables in the stack, so the
> stack has to be in the same memory location.
That's an argument against allowing stacks to move, but not against
allowing stacks to have discontiguous segments.
Now, if you had 'pointers' that were actually stack-top-relative offsets
AND they point out of the current frame, that might cause problems.
More information about the Mono-devel-list