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:
“While they stand at home at the door he is dead already,
The only son is dead.
But the mother needs to be better,
She with thin form presently drest in black,
By day her meals untouchd, then at night fitfully sleeping, often waking,
In the midnight waking, weeping, longing with one deep longing,
O that she might withdraw unnoticed, silent from life escape and
withdraw,
To follow, to seek, to be with her dear dead son.”
—Walt Whitman (18191892)
“No person can be considered as possessing a good education without religion. A good education is that which prepares us for our future sphere of action and makes us contented with that situation in life in which God, in his infinite mercy, has seen fit to place us, to be perfectly resigned to our lot in life, whatever it may be.”
—Ann Plato (1820?)