NOTE

1.3 Memory Leak

Memory that cannot be reclaimed may keep growing until an out-of-memory failure. These notes examine leaks starting with memory still referenced by root objects.

Garbage Collection / RuntimeCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is a Memory Leak?

A memory leak occurs when memory usage keeps growing because memory cannot be reclaimed, eventually causing an out-of-memory (OOM) error.

2. Why Do Memory Leaks Happen?

GC cannot reclaim memory referenced by Root objects.

3. How to Solve Memory Leaks

The key is to find Root objects that have not been released.

3.1. Resources Are Not Released

3.2. Too Many Resources Such as Threads Are Created

3.3. Memory Not Managed by GC

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub