liveBook · Manning

Memory leak

A memory leak is the unintended retention of allocated memory that a program no longer needs, preventing that memory from being reclaimed for reuse.

How 5 Manning books explain it

Troubleshooting Java, Second Edition

A memory leak is a software defect in which allocated memory remains unreleased after it is no longer needed.

How it is used
Guides profiling investigations of abnormal memory consumption before slowness, heap exhaustion, or application failure.
How deep it goes
Explains retained references, GC symptoms, diagnostic tools, and a failing Java example, but defers exact retention analysis to heap dumps.
Examples
Uses an unbounded static Java list, VisualVM memory graphs, GC-log entries, and lingering session references as diagnostic examples.
What you can do after
Diagnose suspected leaks with VisualVM and heap-usage logs, distinguish them from insufficient memory, and identify retained references with a heap dump.

Read how Troubleshooting Java, Second Edition explains memory leak →

100 C++ Mistakes and How to Avoid Them

A memory leak is a failure to release dynamically allocated storage after it is no longer accessible or needed.

How it is used
Diagnoses dynamic-resource mistakes in legacy C++ and guides incremental replacement with disciplined ownership.
How deep it goes
Explains leaks through allocation, destruction, polymorphism, and copying, then stops short of leak-detection tooling.
Examples
Uses malloc/free and new/delete listings, a polymorphic Shape/Square hierarchy, and Page copy and unique_ptr examples.
What you can do after
Diagnose/debug leaks by matching allocation with destruction and preserving ownership across inheritance, copying, assignment, and moves.

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

100 Go Mistakes and How to Avoid Them

A memory leak is a failure to release memory or another managed resource after it is no longer needed.

How it is used
Identifies Go code that retains large backing storage or creates repeated timeout resources despite keeping only small values.
How deep it goes
Traces backing-storage and timeout lifetimes through code, then compares copying, clearing references, contexts, and reusable timers.
Examples
Uses a large slice of byte buffers, cached UUIDs extracted from logs, and an hourly timeout in a message loop.
What you can do after
Diagnose/debug with it by checking retained backing storage and timeout lifetimes, then choosing copies, cleared references, or reusable timers.

Read how 100 Go Mistakes and How to Avoid Them explains memory leak →

.NET in Action, Second Edition

A memory leak is a condition in which memory remains allocated or unreachable despite no longer being needed by a program.

How it is used
Frames memory leaks as a reliability risk of explicit heap management when comparing C++ with .NET garbage collection.
How deep it goes
Defines a leak through unfreed allocation and a lost pointer, without developing a leak-diagnosis procedure.
Examples
Uses a C++ dynamically allocated integer array and its C# array counterpart.
What you can do after
Diagnose/debug with it by recognizing when allocated C++ array memory is not freed before its pointer is lost.

Read how .NET in Action, Second Edition explains memory leak →

Idiomatic Rust

A memory leak is a failure to release dynamically allocated memory after it is no longer reachable or needed.

How it is used
Diagnoses unreleased heap allocations and motivates automatic cleanup through C++ object lifetime management.
How deep it goes
Traces malloc, pointer scope, early returns, and free, then contrasts them with C++ cleanup objects.
Examples
Uses malloc(sizeof(int)), a failing fopen branch, free(a), shared_ptr<int>, and ifstream.
What you can do after
Diagnose leaks by matching every heap allocation with cleanup across all return paths.

Read how Idiomatic Rust explains memory 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.