Technology Fundamentals

Stack Overflow

Definition

In software, a stack overflow is a bug that occurs when the call stack, which is used to store information about the active subroutines (functions) in a program, grows beyond the memory reserved for it.

Why It Matters

A stack overflow will typically cause the program to crash. It's a common bug that developers need to know how to diagnose and fix.

Contextual Example

The most common cause of a stack overflow is a recursive function that fails to reach its base case, causing it to call itself infinitely. Each call adds a new frame to the stack until it runs out of space.

Common Misunderstandings

  • Stack Overflow is also the name of a very popular question-and-answer website for programmers.
  • It is different from a "heap overflow," which relates to a different area of memory.

Related Terms

Last Updated: December 17, 2025