About

The primary purpose of a call stack is to store the return addresses of each active function (subroutine). When a function (subroutine) is called, the location (address) of the instruction at which the calling routine can later resume is stored in the call stack.

More generally, a call stack is a stack data structure that stores information about the active subroutines (function) of a computer program.

Same as:

Call stack is also known as :

  • execution stack,
  • program stack,
  • control stack,
  • run-time stack,
  • or machine stack,

and is often shortened to just the stack.

The process is as follow:

  • The caller pushes the return address onto the stack (winding)
  • The caller calls the subroutine
  • The subroutine, when it finishes, pulls and remove the return address off the call stack (unwinding)
  • The subroutine call the return address.

If the pushing consumes all of the space allocated for the call stack, an error called a wiki/stack overflow occurs, generally causing the program to crash.

There is usually exactly one call stack associated with a process

Management

Manipulation

Documentation / Reference