Stack Unwinding

Noun · Development

Definitions

  1. The process by which the runtime walks back up the call stack after an exception is thrown (or a panic occurs), calling destructors for all local objects in each frame to ensure proper cleanup before control reaches a matching catch block or terminates the program. In C++, unwinding guarantees RAII cleanup; Rust panics unwind by default but can be configured to abort instead.

    In plain English: The process of backing out of nested function calls after an error, cleaning up resources in each one along the way.

    Example: "The crash happens during stack unwinding — a destructor throws a second exception, and in C++ that's instant std::terminate."

Related Terms