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:
“The difference between Pound and Whitman is not between the democrat who in deep distress could look hopefully toward the future and the fascist madly in love with the past. It is that between the woodsman and the woodcarver. It is that between the mystic harking back to his vision and the artist whose first allegiance is to his craft, and so to the reality it presents.”
—Babette Deutsch (18951982)
“And universal Nature, through her vast
And crowded whole, an infinite paroquet,
Repeats one note.”
—Ralph Waldo Emerson (18031882)