Tagged articles
MemoryLeak
35 articles · Page 1 of 1
This article explains how ThreadLocal provides per‑thread variable copies in Java web applications, details its internal storage in Thread objects, showcases ten practical scenarios—from request tracing to async tasks—and highlights common pitfalls such as memory leaks and thread‑pool data contamination, offering concrete best‑practice recommendations.
ConcurrencyJavaLogging
0 likes · 23 min read

A senior architect introduced a high‑concurrency monitoring feature that used ConcurrentHashMap, but missing equals/hashCode and non‑atomic updates caused massive memory leaks and race conditions, leading to a post‑mortem that highlights proper key implementation, atomic map operations, and cautious synchronization.
ConcurrencyConcurrentHashMapJava
0 likes · 7 min read

The article examines a production OutOfMemoryError caused by MyBatis SQL construction, explains heap and metaspace exhaustion, analyzes MyBatis source code, reproduces the issue with JVM settings, and offers practical recommendations to prevent similar memory failures.
BackendHeapJava
0 likes · 7 min read

An in‑depth investigation of a Java service’s memory alarm reveals that a surge of temporary NioChannel objects, caused by high QPS and insufficient socket reuse, prematurely promotes objects to the old generation, leading to uncollected memory growth, and the article details the diagnosis, GC tuning, and mitigation steps.
G1GCGCJVM
0 likes · 29 min read

This article explains how improper use of ThreadLocal in Java can lead to memory leaks and OutOfMemoryError, outlines common scenarios that trigger OOM, and provides best‑practice solutions such as proper removal and alternative ThreadLocal types.
JavaMemoryLeakOutOfMemoryError
0 likes · 4 min read

The article recounts a series of three OOM incidents in a production service that combines Paimon data lake and RocksDB via an SDK, detailing the step‑by‑step investigation, the discovery of excessive bucket‑driven thread creation and off‑heap memory leaks, and the final mitigation measures that restored stability.
JavaMemoryLeakOOM
0 likes · 23 min read

This article explains how ThreadLocal stores values per thread, details the internal set and get mechanisms, discusses potential memory‑leak problems caused by stale entries, and provides best‑practice guidelines such as using remove() and InheritableThreadLocal for child threads.
InheritableThreadLocalJavaMemoryLeak
0 likes · 9 min read

After upgrading core services to JDK 11, the team encountered a Metaspace rise and off‑heap memory growth caused by class‑loading changes and Netty’s disabled native buffers, which were resolved by expanding Metaspace to 768 MB and adding JVM options to enable Netty reflection and open required modules, restoring normal memory usage.
JDK11JVMMemoryLeak
0 likes · 8 min read

An overconfident architect introduced a high‑traffic monitoring feature using ConcurrentHashMap without proper equals/hashCode overrides, causing millions of duplicate keys, memory leaks, and crashes; the team debated synchronized versus putIfAbsent solutions, ultimately fixing the bug and highlighting essential concurrency and code‑review practices for Java back‑end development.
CodeReviewConcurrentHashMapMemoryLeak
0 likes · 7 min read

A senior architect introduced a high‑concurrency monitoring feature that used a ConcurrentHashMap without proper equals/hashCode implementations, leading to duplicate keys, race conditions, and severe memory leaks, which were later resolved by correcting the key class and applying atomic map operations.
ConcurrentHashMapJavaMemoryLeak
0 likes · 8 min read

This article details a step‑by‑step investigation of a container whose memory usage spiked to 99% due to large objects being allocated to the old generation under G1GC, explains the root cause, demonstrates reproducible tests with JVM flags and monitoring tools, and provides practical mitigation strategies.
BackendDockerFullGC
0 likes · 15 min read

This article examines how anonymous inner classes and lambda expressions differ in their handling of outer class references, analyzes compiled bytecode to reveal potential memory leak risks, and demonstrates how explicit references affect lambda behavior in Java Android development.
AndroidAnonymousInnerClassJava
0 likes · 9 min read

This article walks through a real‑world G1 GC incident where massive humongous object allocations caused old‑generation memory spikes at night, explains the underlying JVM memory layout, shows how to trace the problem with heap dumps and monitoring data, and offers practical tips to avoid similar issues in Java applications.
G1GCHumongousObjectJVM
0 likes · 41 min read

Switching a Java Netty gateway from GZIP to ZSTD compression using zstd‑jni doubled GC time and introduced heap and Netty off‑heap memory leaks, which were resolved by employing the library’s direct off‑heap API with a NoFinalizer compressor, promptly releasing ByteBufs, avoiding finalize(), and adopting jemalloc to reduce fragmentation.
GCJavaMemoryLeak
0 likes · 19 min read

The article compares JDK ThreadLocal and Netty FastThreadLocal, detailing their implementations, performance trade‑offs, and memory‑leak risks, illustrates a real‑world HTTPS bug caused by missing remove() calls, and recommends always cleaning up ThreadLocal values while noting FastThreadLocal’s O(1) access may not always outperform the JDK version.
ConcurrencyFastThreadLocalJava
0 likes · 17 min read

This article investigates the severe memory growth and latency spikes observed when synchronizing data across data centers in a Netty‑driven online computation service, analyzes the impact of JDK 17 ZGC and direct‑buffer allocation, and presents the debugging steps, source‑code insights, and configuration changes that ultimately resolved the issue.
DirectMemoryJavaMemoryLeak
0 likes · 13 min read


政采云技术Aug 31, 2023 · Backend Development
ThreadLocal provides each Java thread with its own isolated variable copy, and this article explains its underlying mechanism, core methods (set, get, remove), internal ThreadLocalMap structure, practical code examples, common usage scenarios, and important considerations such as memory leaks and proper cleanup.
BackendConcurrencyJava
0 likes · 12 min read

This article investigates the root causes of frequent OutOfMemoryError incidents in a distributed Java backend, explains how MyBatis and DruidDataSource can exhaust heap and metaspace, demonstrates a reproducible test with JVM options and multithreading, and offers practical mitigation strategies.
DockerJavaMemoryLeak
0 likes · 7 min read

The article details how the author traced V8FatalErrorCallback out‑of‑memory crashes in an Electron‑based Taobao Live client to an ever‑growing compilation cache and pointer‑compression limits, rebuilt Electron with those disabled, identified a JavaScript memory leak caused by unfiltered error logging, and implemented runtime heap monitoring to prevent future OOM failures.
ChromeDevToolsElectronMemoryLeak
0 likes · 35 min read

This article explains the internal workings of Java's ThreadLocal, including the ThreadLocalMap structure, weak reference handling, lazy initialization, and common pitfalls such as memory leaks in thread pools, and provides best‑practice guidelines for safe usage.
BestPracticesConcurrencyJava
0 likes · 7 min read

The report analyzes recurring morning Full GC alerts in a Java service, identifies a Groovy‑driven scheduled task as the root cause through JVM parameter review, log inspection, and memory profiling, and proposes concrete fixes such as reusing a single GroovyShell instance and clearing its classloader cache.
FullGCGroovyJVM
0 likes · 8 min read

The article explains how improper use of java.lang.ThreadLocal in thread pools—failing to re‑initialize or clear values—can cause OOM, loss of implicit parameters, and data corruption, and provides recommendations for safe handling.
ConcurrencyJavaMemoryLeak
0 likes · 3 min read

The article explains how submitting tasks to ExecutorCompletionService without retrieving their results causes the internal unbounded LinkedBlockingQueue to retain Future objects, leading to memory leaks and OutOfMemoryError, and demonstrates the correct usage patterns to prevent this issue.
ConcurrencyExecutorCompletionServiceJava
0 likes · 6 min read

This article explains why ThreadLocal is used in Java concurrency, dives into its internal implementation—including ThreadLocalMap, weak‑referenced keys, hash‑based indexing and resizing—covers common pitfalls such as memory leaks, and shows how InheritableThreadLocal and TransmittableThreadLocal can safely share data across child threads and thread pools.
ConcurrencyInheritableThreadLocalJava
0 likes · 24 min read

This article explains the root causes of Out‑Of‑Memory (OOM) crashes on Android, classifies OOM types, and provides practical, non‑intrusive solutions for thread‑count, file‑descriptor, and heap‑memory problems, along with monitoring techniques using thread pools, image compression, LeakCanary, KOOM and native hooks.
AndroidMemoryLeakMobileDev
0 likes · 23 min read

Using ThreadLocal to store user information in Java web applications can lead to hidden failures such as loss of context and memory leaks, especially when thread pools are involved, so developers should restrict its usage to controller threads and employ static analysis tools to detect improper usage.
ConcurrencyJavaMemoryLeak
0 likes · 4 min read

This article explains the causes of Java out‑of‑memory problems, introduces essential diagnostic commands and memory‑analysis tools, and walks through a real‑world case study that shows how to locate, analyze, and fix a memory leak caused by unreleased OSS client connections.
JVMMemoryLeakOutOfMemory
0 likes · 7 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 examines a JDK bug causing memory leaks in Jetty's QueuedThreadPool due to improper removal in ConcurrentLinkedQueue, demonstrates the issue with a long‑running demo, analyzes heap growth using jconsole, VisualVM and jmc, and shows how newer JDK versions fix the problem.
ConcurrentLinkedQueueJDKJava
0 likes · 14 min read

This article explains the root cause of a memory‑leak bug in JDK8's ConcurrentLinkedQueue, demonstrates how to reproduce and visualize the issue with custom CLQ implementations, analyzes the removal algorithm, and shares practical debugging tips including a notorious IDEA debug pitfall and its resolution.
ConcurrentLinkedQueueJDK8Java
0 likes · 14 min read

This article explains the internal architecture of Java's ThreadLocal, including its ThreadLocalMap implementation, the purpose of the special hash code 0x61c88647, collision handling strategies, proper usage patterns in web applications, and precautions for avoiding memory leaks in thread pools.
ConcurrencyJavaMemoryLeak
0 likes · 12 min read

During a weekend on‑call shift I traced repeated timeout alerts to network packet loss and a severe JVM memory leak, used jstat, jmap and Eclipse MAT to pinpoint the culprit, and resolved the issue by fixing a never‑cleared Map in the Java code.
JVMJavaMemoryLeak
0 likes · 9 min read

This article explains what Java ThreadLocal is, how its API works, demonstrates usage with code examples, dives into the internal ThreadLocalMap implementation, analyzes key methods like get() and set(), and discusses the memory‑leak risks and how to avoid them.
ConcurrencyJavaMemoryLeak
0 likes · 13 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

In ReactiveCocoa, using RACObserve inside a flattenMap or applying map to a hot RACSubject can create retain cycles because the generated blocks capture self and the subject retains its subscribers, so employing @weakify/@strongify and ensuring signals send a completed or error event breaks these hidden memory leaks.
MemoryLeakObjective-C++ReactiveCocoa
0 likes · 15 min read
