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 older womans love is not love of herself, nor of herself mirrored in a lovers eyes, nor is it corrupted by need. It is a feeling of tenderness so still and deep and warm that it gilds every grassblade and blesses every fly. It includes the ones who have a claim on it, and a great deal else besides. I wouldnt have missed it for the world.”
—Germaine Greer (b. 1939)
“Something is infinite if, taking it quantity by quantity, we can always take something outside.”
—Aristotle (384322 B.C.)