Very Deep or Infinite Recursion
The most common cause of stack overflow is excessively deep or infinite recursion. Languages like Scheme, which implement tail-call optimization, allow infinite recursion of a specific sort—tail recursion—to occur without stack overflow. This works because tail-recursion calls do not take up additional stack space.
An example of infinite recursion in C.
int foo { return foo; }The function foo, when it is invoked, continues to invoke itself, using additional space on the stack each time, until the stack overflows resulting in a segmentation fault.
Read more about this topic: Stack Overflow
Famous quotes containing the words deep and/or infinite:
“It smells like gangrene starting in a mildewed silo; it tastes like the wrath to come, and when you absorb a deep swig of it you have all the sensations of having swallowed a lighted kerosene lamp.”
—For the State of Kentucky, U.S. public relief program (1935-1943)
“I feel that the Godhead is broken up like the bread at the Supper, and that we are the pieces. Hence this infinite fraternity of feeling.”
—Herman Melville (18191891)