Stack overflow
A stack overflow is a runtime failure caused by exhausting the available capacity of a program’s call stack.
Embedded Software with Rust
Stack overflow is the exhaustion of a thread's stack space by nested calls, local data, or other stack allocation.
- How it is used
- Addresses silent memory corruption in resource-constrained, single-stack bare-metal firmware.
- How deep it goes
- Explains overflow mechanics and layered defenses, including linker layout and MPU registers, while deferring multi-task stack management.
- Examples
- Uses a recursive function with a 1 KiB local buffer, a flip-link configuration, and a 32-byte MPU guard.
- What you can do after
- Operate and configure flip-link and MPU guards to turn stack overflows into diagnosable faults.
Read how Embedded Software with Rust explains stack overflow →
100 Java Mistakes and How to Avoid Them
A stack overflow is exhaustion of the call stack caused by excessive or unbounded nested execution.
- How it is used
- Warns against recursion whose excessive depth or repeated state exhausts a thread’s call stack.
- How deep it goes
- Explains JVM-dependent limits, tail-call elimination, loop rewrites, and cyclic traversal, without providing a fixed safe recursion depth.
- Examples
- Uses tail-recursive string search, tree traversal, button delegation, and self-referential lists.
- What you can do after
- Diagnose/debug with it by separating deep finite recursion from unchanged-state recursion and cyclic traversal.
Read how 100 Java Mistakes and How to Avoid Them explains stack overflow →
Also covered in
What to know first
- recursionRecursion is a computational technique in which a definition or procedure refers to or invokes itself, directly or indirectly.
- performancePerformance is a measure of how effectively a person, process, model, or system achieves its objectives, including qualities such as output quality, speed, and resource efficiency.
- RustRust is a statically typed systems programming language designed for performance, concurrency, and memory safety without requiring garbage collection.
- stack pointerA stack pointer is a processor register or equivalent value that identifies the current top position of a stack in memory.
Related concepts
- recursionproduced by · Recursion is a computational technique in which a definition or procedure refers to or invokes itself, directly or indirectly.
- flip-linkaddressed by · flip-link is a linker wrapper that rearranges embedded memory layouts to place the main stack below other RAM sections and detect downward stack overflow.
- stack pointerused by · A stack pointer is a processor register or equivalent value that identifies the current top position of a stack in memory.
- trampoliningaddressed by · Trampolining is a technique that represents chained function calls as iterative steps to avoid growing the call stack.
Questions about stack overflow
What is stack overflow?
A stack overflow is a runtime failure caused by exhausting the available capacity of a program’s call stack.
Which Manning books explain stack overflow?
Embedded Software with Rust and 100 Java Mistakes and How to Avoid Them.
What should I know before learning stack overflow?
Manning books that teach stack overflow usually introduce recursion, performance, Rust and stack pointer first.
What is stack overflow also called?
Stack overflow is also called StackOverflowError.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

