Btw, it’s possible to increase the stack size for a function by running it in a separate Task with larger stack size. The method is described here: Experiments with Julia Stack Sizes and Enzyme
It’s just to use the second argument of Task, which even is documented now:
function with_stacksize(f::F, n) where {F<:Function}
fetch(schedule(Task(f, n)))
end
with_stacksize(N) do # N bytes stack
...
end