C# Recursion Depth – How Deep can you go

I’ve increased the stack size during some documents recognition. It was really needed.

So you can increase stack size for thread using following code:

var stackSize = 10000000;
Thread thread = new Thread(new ThreadStart(BigRecursion), stackSize);

Thread(ThreadStart, Int32) —
Initializes a new instance of the
Thread class, specifying the maximum
stack size for the thread.

Source

Hope this what you need.

Leave a Comment