# StackOverflowError after only 14 calls to the same function?

**URL:** <https://discourse.julialang.org/t/stackoverflowerror-after-only-14-calls-to-the-same-function/133693>\
**Category:** General Usage\
**Tags:** stackoverflow\
**Created:** [November 5, 2025, 11:14pm UTC](https://discourse.julialang.org/t/stackoverflowerror-after-only-14-calls-to-the-same-function/133693 "2025-11-05T23:14:28Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![sgaure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sgaure/32/14779_2.png) [@sgaure](https://discourse.julialang.org/u/sgaure)\
**Post date:** [November 6, 2025, 9:16am UTC](https://discourse.julialang.org/t/stackoverflowerror-after-only-14-calls-to-the-same-function/133693/4 "2025-11-06T09:16:41Z")

</div>

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](https://discourse.julialang.org/t/experiments-with-julia-stack-sizes-and-enzyme/116511)

It’s just to use the second argument of `Task`, which even is documented now:

```julia-auto
function with_stacksize(f::F, n) where {F<:Function}
    fetch(schedule(Task(f, n)))
end

with_stacksize(N) do # N bytes stack
    ...
end

```

---

_[View the full topic](https://discourse.julialang.org/t/stackoverflowerror-after-only-14-calls-to-the-same-function/133693)._
