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:
“Under all speech that is good for anything there lies a silence that is better. Silence is deep as Eternity; speech is shallow as Time.”
—Thomas Carlyle (17951881)
“If I could only live at the pitch that is near madness
When everything is as it was in my childhood
Violent, vivid, and of infinite possibility:
That the sun and the moon broke over my head.”
—Richard Eberhart (b. 1904)