Function stacker::maybe_grow
source · [−]Expand description
Grows the call stack if necessary.
This function is intended to be called at manually instrumented points in a program where
recursion is known to happen quite a bit. This function will check to see if we’re within
red_zone
bytes of the end of the stack, and if so it will allocate a new stack of at least
stack_size
bytes.
The closure f
is guaranteed to run on a stack with at least red_zone
bytes, and it will be
run on the current stack if there’s space available.