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:
“I remember the scenes of battle in which we stood together. I remember especially that broad and deep grave at the foot of the Resaca hill where we left those gallant comrades who fell in that desperate charge. I remember, through it all, the gallantry, devotion and steadfastness, the high-set patriotism you always exhibited.”
—Benjamin Harrison (18331901)
“i thank You God for most this amazing
day: for the leaping greenly spirits of trees
and a blue true dream of sky; and for everything
which is natural which is infinite which is yes”
—E.E. (Edward Estlin)