Skip to content
uencoder

Call Stack

The call stack stores function-call information (arguments, local variables, return addresses) in last-in-first-out order; a returning function pops its stack frame.

Purpose

Understand function-call mechanics and the causes of stack overflow, as the basis for debugging backtraces.

Mechanism

Calling a function pushes a stack frame (arguments, local variables, return address). Returning pops the frame and jumps to the return address. The stack has a limited size, so deep recursion causes stack overflow. Tail-call optimization reuses stack frames. The DevTools call-stack panel aids debugging.

Use cases

  • Debugging
  • Profiling
  • Recursion optimization

Related terms

References