- Home /
How to increase the Call Stack Size in Unity?
Hello everyone!
Is there a way to increase the size of the call stack for Windows/PC in Unity?
From what I know the normal size on Windows is 1 MB, and that's usually more than enough, but I have a really expensive Backtracking Algorithm - it works on Mac with a seemingly larger stack, but crashes on Windows. My current workaround is setting up a new thread with a custom 10 MB stack - that works but has other drawbacks, so I figured increasing the stack of the main thread could help.
Weird thing about the crash is the following though: Because of the observations above I am very sure that it's crashing because of the stack, though Unity isn't throwing any Overflow Exceptions, it just silently closes without any kind of error or message. Could there be another, deeper problem that I'm not seeing?
The backtracker itself isn't even going that deep as well. Looking at a stack trace right before a crash shows that it's "only" 3000 recursions deep (which should be fine, I think?). I'm having a lot of foreach-loops in combination with Enumerable-Functions in my Backtracker too, but I'm not sure if they are to blame. So, maybe there's a way to solve this problem without touching the stack size?
I'd be really glad for any suggestions!
Your answer
Follow this Question
Related Questions
Need to use HDD instead of RAM 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
C#/Unity Stack size and memory leaks 5 Answers
Why does Unity crash? (and other programs in general) 1 Answer