Tail-calling, or tail recursion, is a functional programming technique by which a function calls a subroutine function as its final procedure before returning control to its own caller. Direct recursion occurs when a function calls itself recursively. Recursion is mutual, or indirect, if a function calls another function which, in turn, calls the original function.
Thus, for example, when a function tail-calls itself, it stacks itself over and over again until a certain condition is met, at which point it will definitely return, thus effectively popping the entire call stack.
Optimizing tail-calls consists of popping the current function from the call stack before performing the tail-call and keeping the current function's caller address as the return address for the tail-call. Thus, the memory footprint of the stack remains small and stack overflow is in fact avoided altogether.