liveBook · Manning

Resource leak

A resource leak is the failure to release an acquired resource after it is no longer needed, leaving it occupied or unavailable for reuse.

How 3 Manning books explain it

100 C++ Mistakes and How to Avoid Them

A resource leak is a failure to release an acquired resource, leaving it allocated or unavailable for reuse.

How it is used
Uses resource leaks as a practical C++ correctness mistake involving exceptions, termination, ownership, and cleanup.
How deep it goes
Explains failure paths with code and cleanup traces, then stops short of redesigning legacy systems comprehensively.
Examples
Uses database connections, file-backed page text, dynamic grade arrays, and locally returned strings as failure examples.
What you can do after
Diagnose/debug with it by tracing ownership, destructor execution, exception paths, and cleanup responsibility.

Read how 100 C++ Mistakes and How to Avoid Them explains resource leak →

Functional Programming in Scala, Second Edition

A resource leak is failure to release an acquired resource, such as an open file handle, after it is no longer needed.

How it is used
Frames resource leaks as a practical failure mode in incremental file processing and a motivation for resource-safe abstractions.
How deep it goes
Explains normal and exceptional cleanup, then stops short of presenting a compiler-enforced resource-safety implementation.
Examples
Uses an imperative Scala file counter whose finally block closes the source after incremental iteration.
What you can do after
Diagnose leaks by identifying acquired resources whose cleanup is omitted or bypassed by exceptions.

Read how Functional Programming in Scala, Second Edition explains resource leak →

Kotlin in Action, 2E

A resource leak is the unintended retention or failure to release of resources such as threads, memory, or active concurrent tasks.

How it is used
Uses cancellation-safe cleanup and structured concurrency to prevent unreleased resources in concurrent Kotlin code.
How deep it goes
Explains the failure scenario and two cleanup mechanisms, but stops short of broader resource-management diagnostics.
Examples
Uses a cancellable DatabaseConnection coroutine, an explicit finally block, and the use function as contrasting cleanup examples.
What you can do after
Diagnose/debug with it by identifying cancellation paths and applying finally, use, or structured concurrency to guarantee cleanup.

Read how Kotlin in Action, 2E explains resource leak →

Related concepts

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.