concept stack in category kotlin

This is an excerpt from Manning's book The Joy of Kotlin.
Using more memory isn’t the worst problem of recursion. What makes the problem even worse is that computer languages use the stack for storing computation steps. This is smart because computation steps must be evaluated in reverse order compared to the order in which they were stacked. Unfortunately, the stack size is limited, so if there are too many steps, the stack will overflow, crashing the computation thread.
How many computation steps can safely be pushed onto the stack is language-dependent and can be configured. In Kotlin, it’s about 20,000; in Java, it’s about 3,000. Configuring the stack size to a higher value might not be a good idea because the same stack size (but not the same stack area) is used by all threads. And a higher stack size is often a waste of memory, given that nonrecursive processes use little stack space.