Tagged articles
WeakReference
15 articles · Page 1 of 1

XikeSep 9, 2026 · Fundamentals
ThreadLocal provides per-thread variable copies via a ThreadLocalMap with weak-reference keys and strong-reference values, enabling request-context storage and non-thread-safe object reuse, but risks memory leaks in long-lived thread pools unless explicitly removed, and requires careful handling for cross-thread propagation.
Best PracticesInheritableThreadLocalJava Concurrency
0 likes · 14 min read

This article explains the internal design of Java's ThreadLocalMap, covering its core Entry structure, hash table storage, linear probing for collision resolution, key operations (set, get, remove), memory‑leak scenarios, automatic cleanup mechanisms, and practical usage patterns such as thread‑context propagation and Android Looper.
ConcurrencyJavaMemoryManagement
0 likes · 10 min read

Exploring the differences between PhantomReference and WeakReference in Java’s ZGC, this article explains how ZGC’s concurrent phases and the should_drop method use distinct bitmap bits to determine object liveness, revealing why only PhantomReference reliably tracks object reclamation in certain finalization scenarios.
JVMJavaPhantomReference
0 likes · 11 min read

Explore Java’s four reference types—strong, soft, weak, and phantom—understanding their behavior, garbage collection interactions, practical code examples, and best-use scenarios, while learning how to manage memory efficiently and avoid pitfalls such as improper finalize() overrides.
JavaPhantomReferenceReference Types
0 likes · 9 min read

This article explains the ThreadLocal architecture, why its internal ThreadLocalMap uses weak references, and how improper handling of ThreadLocal entries can lead to memory leaks, offering clear guidance for Java developers on safe usage and garbage‑collection behavior.
MemoryLeakThreadLocalWeakReference
0 likes · 8 min read

This article explains Java's four reference types—strong, soft, weak, and phantom—detailing their purposes, behavior during garbage collection, and practical code examples that demonstrate how each reference influences object lifecycle and memory management.
JavaPhantomReferenceReference Types
0 likes · 9 min read

This article explains the four kinds of Java references—strong, soft, weak, and phantom—how they interact with the garbage collector, the role of ReferenceQueue, and provides practical code examples and JVM internal details to help developers manage object lifecycles effectively.
JVMJavaPhantomReference
0 likes · 22 min read

This article examines why DialogFragment can cause memory leaks in Android apps, analyzes the role of HandlerThread messages and Looper processing, and presents several mitigation strategies including avoiding dismiss listeners, using weak references, and custom fragment implementations to safely release resources.
DialogFragmentLeakCanaryLooper
0 likes · 11 min read

This article explains Java's four reference types, focusing on the implementation and lifecycle of SoftReference, WeakReference, and PhantomReference, and clarifies how garbage collection policies, native and Java layers, and reference queues determine when these references are cleared or notified.
JavaPhantomReferenceSoftReference
0 likes · 14 min read

This article explains how Java developers can leverage strong, soft, weak, and phantom references—along with SoftReference, WeakReference, and WeakHashMap—to optimize memory usage, improve cache performance, and demonstrate advanced JVM tuning skills during technical interviews.
Interview TipsJavaSoftReference
0 likes · 12 min read

This article explains how to use the Model‑View‑Presenter (MVP) pattern in Android to reduce module coupling, prevent memory leaks with WeakReference, and organize code into clear layers—View, Presenter, Model, and a Data Manager—while providing step‑by‑step implementations and reusable base classes.
AndroidMVPPresenter
0 likes · 14 min read

This article explains the inner workings of ThreadLocal, the relationships among Thread, ThreadLocalMap, Entry, and various reference types, demonstrates how weak references behave during garbage collection, and shows practical code examples and reference‑queue usage to avoid memory‑leak pitfalls.
GarbageCollectionJavaMemoryLeak
0 likes · 13 min read

This article explains how Java ThreadLocal works internally, details its core methods and internal classes, analyzes the relationship between Thread, ThreadLocalMap, and WeakReference, and discusses memory‑reclamation strategies and potential OOM issues when used with thread pools.
ConcurrencyJavaThreadLocal
0 likes · 13 min read

The article presents a detailed case study of an Android WebView memory‑leak bug that gradually slows page opening, explains how DDMS and MAT were used to pinpoint the leaking DynamicBgDrawable objects, and describes the fix of converting a strong view reference to a weak reference to eliminate the leak.
AndroidMATMemory Leak
0 likes · 9 min read

The article presents a detailed case study of an Android WebView memory leak that causes progressively slower page loads, explains how DDMS and MAT were used to pinpoint the leak in DynamicBgDrawable via a WeakHashMap reference cycle, and proposes converting the view reference to a weak reference to resolve the issue.
AndroidGCMAT
0 likes · 9 min read
