This article explains how Python's del statement removes variable references, how the interpreter's garbage collection mechanisms reclaim memory—including reference counting and cyclic‑reference detection—and provides multiple code examples demonstrating proper resource cleanup in automated testing scenarios.
This article explains how BuildContext and various closure patterns in Flutter can cause memory leaks, demonstrates typical leak scenarios with code examples, and provides practical strategies such as disposing listeners, nullifying references, and using WeakReference or Finalizer to ensure proper garbage collection.
This article explains how to plan capacity, choose the appropriate garbage collector, allocate heap and non‑heap memory, and configure JVM flags—including Xms, Xmx, Xmn, Xss, and GC‑specific options—to reliably support a service node with 8 GB RAM handling one million login requests per day.
This article explains how Java’s garbage collector interacts with the four reference types—Strong, Soft, Weak, and Phantom—detailing their behavior, typical use cases, and code examples that show when each reference allows an object to be reclaimed.
This article explains how Java classes are loaded into the JVM, details the class loader’s parent‑delegation mechanism, and walks through the execution flow of a sample program, covering stack frames, heap allocation, dynamic linking, method area, program counter, native method stack, and garbage collection.
This article walks through a systematic approach to sizing and configuring JVM parameters—including heap size, young generation, GC algorithm selection, and advanced options—for a high‑traffic login service that processes one million requests per day on a server with 8 GB of memory, while explaining the underlying performance‑analysis methodology.
This article provides a detailed technical analysis of Go's runtime memory management, covering the initialization of the mheap structure, small‑object allocation via mcache, large‑object handling, the three‑color mark‑and‑sweep garbage collector, memory release mechanisms, and the optimization techniques that coordinate mcache and mheap for efficient concurrent execution.
This article explains, step by step, how to estimate capacity, choose the appropriate garbage collector, size the young and old generations, configure stack memory, adjust object aging thresholds, and fine‑tune CMS or G1 settings so that a Java service handling one million daily logins can run reliably on an 8 GB node.
This article explains how to analyze per‑second object memory usage in a 100k TPS e‑commerce order flow, choose an appropriate garbage collector, set heap and young‑generation sizes, and apply common JVM tuning parameters to reduce Full GC pauses and improve latency and throughput.
QuickJS manages memory using reference counting for each object combined with a cycle‑collector that periodically scans roots, decrements child references, and frees objects whose counts drop to zero, while also supporting traditional reachability‑based garbage‑collection techniques such as mark‑sweep, copying, and generational collection.
This article explains the core concepts of the G1 garbage collector, including its memory management duties, heap region types and sizing, pause‑time prediction model, card table and bitmap usage, object header structure, and both fast and slow object allocation strategies.
This article provides a comprehensive overview of garbage collection techniques, covering reference counting, reachability analysis, generational management, copy, mark‑sweep, and mark‑compact algorithms, and explains the JVM's serial, parallel, CMS, and G1 collectors along with their operational characteristics and trade‑offs.
This article explains how to launch Java processes from the command line, explores JVM -X and -XX tuning parameters, details garbage‑collection algorithms, describes reference strengths, and clarifies object reachability to help developers optimize Java application performance.
This article examines the concept of weak pointers and weak references in Go, Rust, Java, and C#, comparing their implementations, explaining their memory‑management semantics, presenting concrete code examples, and discussing the upcoming Go weak‑pointer proposal and practical scenarios such as caching and event handling.
Go 1.23 introduces the unique package, which provides generic interning for comparable values, allowing canonicalization of strings and structs, reducing memory usage and speeding up equality checks; the article walks through a simple map‑based implementation, its limitations, the advanced Handle[T] design, real‑world netip usage, and future prospects.
This article explains how Node.js manages memory, details V8's garbage‑collection mechanisms, shows how to monitor heap usage, demonstrates techniques for increasing allocation limits, and provides practical code samples and third‑party tools for detecting and fixing memory leaks in production environments.
This guide introduces Java performance analysis fundamentals, covering profiling tools, key metrics such as CPU, memory, thread behavior, and practical methods to detect and resolve common issues like memory leaks, GC pauses, high CPU usage, I/O bottlenecks, and inefficient collection usage.
This article explains why JVM tuning is essential for performance, outlines a step‑by‑step optimization workflow—including GC monitoring, heap dumps, parameter tuning, and tool usage—provides a concrete Java code example that triggers memory pressure, and shares effective JVM flags to prevent out‑of‑memory errors.
This article explains the internal mechanisms of JVM garbage collection, covering oopMap, safepoints, saferegions, three‑color marking, memory sets, write barriers, and the design of low‑latency collectors such as Shenandoah and ZGC, and provides practical tuning advice.
This article provides a comprehensive overview of Java garbage collection, covering the principles of reference counting and reachability analysis, detailing major GC algorithms such as mark‑sweep, copying, and mark‑compact, explaining object allocation strategies, and reviewing traditional and modern collectors like Serial, CMS, and G1, with practical tuning tips for each.
This article explains the motivations for upgrading to JDK21, introduces Generational ZGC, details integration steps and monitoring setup, presents performance test results comparing ZGC and Generational ZGC, and outlines future plans for Java services at Zhaozhuan.
This article explains why the backend services were upgraded from JDK 8 to JDK 21, introduces the generational ZGC garbage collector, details its architecture, tuning parameters, integration steps, monitoring setup, and presents performance test results that demonstrate reduced allocation stalls, lower latency, higher throughput, and near‑zero GC pauses.
This article explains the JVM memory architecture—including heap, stack, native stack, method area, and program counter—detailing heap generations, object allocation strategies, object layout, reference types, and the complete lifecycle of Java objects from creation to garbage collection.
This article demonstrates how to analyze and optimize Go's garbage collection using go trace, comparing single‑threaded and concurrent implementations, and shows how tuning GOGC and GOMEMLIMIT can dramatically improve runtime and memory usage, with detailed code samples and performance metrics.
This article explains the JVM memory architecture, object lifecycle, young and old generation garbage‑collection mechanisms, tuning goals such as low latency, high throughput and large heap, and provides practical advice on monitoring, common memory‑related problems, and choosing appropriate collectors for different application scenarios.
This comprehensive guide explains the fundamentals of HotSpot CMS garbage collection, identifies nine typical GC problem scenarios, analyzes their root causes, and provides practical tuning strategies, code examples, and diagnostic tools to help Java engineers optimize performance and avoid costly pauses.
This article examines why Go's garbage collector can become a CPU bottleneck with large heaps, demonstrates the performance impact with benchmark programs, and presents practical strategies—such as using pointer‑free allocations, mmap‑backed memory, and string interning—to dramatically reduce GC pause times.
This article explains the various forms of Java OutOfMemoryError, their underlying causes such as heap exhaustion, GC overhead, metaspace limits, and native allocation failures, and provides practical solutions and code snippets to diagnose and resolve each scenario.
This article explains Go's memory management by detailing stack and heap differences, describing classic and modern garbage‑collection algorithms, tracing the evolution of Go's GC from version 1.3 to 1.8, and outlining a complete GC cycle with practical code examples.
This guide explains how to enable detailed G1 GC logging in Java, interprets both Minor (YGC) and Full GC log entries, breaks down heap size changes, worker threads, pause times, and points to the GCEasy analysis tool for deeper insight.
This article explains Java Metaspace and metadata GC thresholds, compares PermGen with Metaspace, and provides detailed JVM flag configurations—including size settings and compressed pointer options—to help developers optimize memory usage and garbage‑collection performance.
This article explains the principles, features, and workflow of Java's Z Garbage Collector, provides detailed configuration and logging guidance, and shares AutoMQ's practical tuning experiences that achieve sub‑millisecond pause times and improved performance for latency‑sensitive backend services.
This article explains Java heap memory concepts, garbage collection mechanisms, common memory issues, and outlines the team's quality assurance framework, including testing left‑shift with AI code review and right‑shift monitoring to improve reliability and performance.
This article explains Java heap memory concepts, garbage collection, common memory issues like leaks and OutOfMemoryError, and outlines the team's quality assurance framework—including left‑shift code review, right‑shift monitoring, and continuous delivery practices—to help prevent and resolve production alerts.
This article provides a comprehensive overview of Java's G1 and ZGC garbage collectors, explaining their memory layout, internal structures such as regions, card tables, and RSet, detailing Young and Mixed GC processes, three‑color marking, SATB, incremental updates, and the low‑pause design of ZGC.
This article provides an in-depth review of common Java backend interview questions, covering alternative object creation methods, practical reflection scenarios, serialization techniques, garbage‑collection algorithms, I/O multiplexing mechanisms, network port listening, and troubleshooting tips for server‑client communication issues.
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.
This article explains how the JVM creates and manages FinalReference objects, how they interact with the finalize() method, and how the ZGC and other GC phases discover, revive, and eventually reclaim objects, detailing the roles of ReferenceHandler, FinalizerThread, and related internal data structures.
This article explains how Java's Thread.sleep(0) works, its native implementation, why it is used in RocketMQ source code, and how the call influences JVM garbage‑collection, safe‑point insertion, and CPU scheduling to improve multithreaded performance.
This article explains how ZGC in OpenJDK 17 decides whether to reclaim SoftReference objects, detailing the unconditional clearing scenarios, the policies governing SoftReference lifetimes, and how the JVM quantifies memory pressure using heap size and the -XX:SoftRefLRUPolicyMSPerMB flag.
This article explains how moving to JDK 17 and the low‑latency ZGC garbage collector can reduce pause times to under 10 ms, improve throughput, and meet demanding real‑time service requirements, while providing practical upgrade steps, JVM tuning parameters, and performance comparisons.
The author celebrates landing a new job while emphasizing that mastering Java's garbage collection—identifying and reclaiming memory from unreachable objects via algorithms like reference counting or reachability analysis—is essential for robust backend development and preventing memory overflow.
This article explains why upgrading to JDK 17 and switching to the low‑latency ZGC garbage collector can dramatically reduce pause times and improve throughput, compares GC and CPU metrics against G1, and provides step‑by‑step installation and JVM tuning instructions with code examples.
This article explains how ZGC in JDK 17 eliminates long GC pauses, compares performance and CPU usage against G1, outlines upgrade reasons, suitable scenarios, and provides step‑by‑step installation and JVM tuning instructions for production Java back‑ends.
This article explains how Go's garbage collector manages adjusted, old, and new stacks, detailing the stack adjustment process, expansion and contraction steps, and practical techniques—including debugging tools, stack printing, memory profiling, and stress testing—to verify correct behavior.
The article explains why a locally created ThreadPoolExecutor cannot be reclaimed by Java's garbage collector, detailing GC root analysis, the role of live threads, inner‑class references, static versus non‑static nesting, and how these concepts can cause memory leaks.
This article explains Go's pointer model, why the language forbids generating pointers from non‑pointer values, how garbage collection and memory compaction cause object addresses to change at runtime, and provides best practices and code examples for safely using pointers in Go programs.
This article explains the fundamentals of garbage collection, compares manual and automatic memory management, outlines common GC algorithms, and provides practical guidance on performance analysis, tool selection, and optimization techniques to improve application responsiveness and resource utilization.
This article explains the two‑phase reachability analysis in Java garbage collection, detailing why the object‑graph traversal stage incurs stop‑the‑world pauses, how the tri‑color marking model reveals issues like floating garbage and object disappearance, and describes incremental update and snapshot‑at‑the‑beginning techniques that avoid STW.
This article explains Go's memory escape phenomenon, why variables move to the heap, its impact on garbage collection performance, and practical techniques—including pointer usage, closure avoidance, and compiler tools—to minimize escape and improve program efficiency.
The article surveys seven common garbage‑collection algorithms—Mark‑Sweep, Reference Counting, Copying, Mark‑Compact, Conservative, Generational, and Incremental/Tri‑color—explaining their principles, strengths, weaknesses, evaluation criteria such as throughput and pause time, and practical optimizations, emphasizing that the best choice depends on specific application needs.
This article explains how Java's System.gc triggers full or concurrent garbage collection in NIO scenarios, detailing the JVM's handling of out‑of‑memory errors during memory‑mapped file operations and direct buffer allocations, and examines the behavior across various garbage collectors such as Serial, Parallel, G1, ZGC, and Shenandoah.
This article provides a comprehensive guide to JVM internals, covering runtime data areas, heap segmentation, object allocation, reference types, class loading phases, garbage collection algorithms, collector choices across JDK versions, performance tuning commands, and practical troubleshooting techniques for production Java applications.
This article explains how PHP’s automatic garbage collector works, detailing reference‑counting, zval structures, handling of scalar and composite types, cycle detection, configuration options, and practical debugging techniques using Xdebug and code samples.
This guide explains why old Kubernetes clusters that use Docker can run out of disk space, describes the symptoms such as pods stuck in ContainerCreating, and provides step‑by‑step commands to clean Docker files, prune images, adjust kubelet settings, and prevent future disk‑full problems.
ZingJDK, Azul’s high‑performance commercial JDK built on OpenJDK, combines ReadyNow® pre‑warming, the LLVM‑based Falcon JIT compiler, the pause‑free C4 concurrent compacting garbage collector, and a cloud‑native off‑load compiler to deliver dramatically faster startup and execution across JDK 7‑21, though it lacks dynamic Attach support and requires a commercial license.
This article explains PHP's key memory management functions—including memory_get_usage, memory_get_peak_usage, gc_collect_cycles, and the memory_limit setting—providing usage syntax, examples, and guidance on optimizing script performance and preventing memory‑related issues.
This article explains the JVM memory model, detailing the five runtime data areas—heap, method area, JVM stack, native method stack, and program counter—along with their structures, configuration parameters, and roles in Java execution and performance tuning.
Over a month of systematic JVM tuning, the author reduced FullGC frequency from 40 times per day to once every ten days, halved YoungGC time, identified and fixed a memory leak caused by anonymous inner‑class listeners, and documented the step‑by‑step optimization process with configuration changes and performance results.
This article documents a month‑long investigation and tuning of a Java backend server, detailing how FullGC frequency was cut from dozens per day to a handful by adjusting heap parameters, fixing a memory‑leak caused by anonymous inner‑class listeners, and optimizing metaspace settings.
The article explains Dart VM’s generational garbage collection, detailing object allocation, the young‑generation Scavenge copying collector, old‑generation Mark‑Sweep and Mark‑Compact algorithms, safepoints, write‑barrier mechanics, debugging a write‑protect crash, and the importance of logging for memory‑management analysis.
This article explains the main Java JVM garbage collectors—including Serial, Parallel, CMS, G1, ZGC, Epsilon, and Shenandoah—detailing their architectures, pause characteristics, suitable workloads, and key advantages, helping developers choose the right collector for different application sizes and latency requirements.
This article compares JDK 8, 17, and 21 using SPECjbb®2015 to evaluate throughput, latency, and memory consumption of G1, Parallel, and generational ZGC, highlighting significant performance gains and offering upgrade guidance for Java applications.
This article provides a comprehensive overview of the major language and runtime enhancements introduced in JDK 12 through JDK 17, covering switch expressions, micro‑benchmarking with JMH, class‑data sharing, garbage‑collector improvements, new String methods, hidden and sealed classes, records, and unified asynchronous logging, all illustrated with code examples.
Learn step‑by‑step how to identify and clean up disk‑space exhaustion in older Kubernetes clusters using Docker, including manual log removal, node draining, Docker restart, image pruning, and configuring kubelet garbage‑collection parameters to prevent future outages.
This article explains how circular references cause memory leaks in Python, describes the role of reference counting and the cyclic garbage collector, and provides practical examples using the weakref and gc modules to create weak references, detect, and manually manage cyclic garbage.
This article provides a comprehensive overview of Python's object‑oriented programming features, covering classes, class and instance variables, methods, inheritance, method overriding, built‑in class attributes, and garbage collection, supplemented with clear code examples and explanations.
A Java rule‑engine experiences occasional 1‑2 second Young GC pauses after warm‑up, caused by dynamic promotion thresholds that trigger massive object promotion, and the article explains the root cause, demonstrates log analysis, and provides JVM tuning steps to eliminate the long pauses.
Python automatically manages memory through garbage collection, and this article explains how the garbage collector works and presents ten practical techniques—including manual gc calls, generators, sys.getsizeof, slice copying, del statements, sys.intern, NumPy, pandas, reference counting, and __slots__—to reduce memory usage and improve performance.
This article explains the principles and usage of dynamic memory allocation in C/C++ (malloc, calloc, realloc, free, new, delete), compares their behaviors, demonstrates common pitfalls, and extends the discussion to Linux kernel memory statistics, cache handling, swappiness tuning, and garbage‑collection concepts.
This article provides a thorough analysis of upgrading Java applications from JDK 8 to JDK 11, covering performance improvements, garbage collector comparisons, new language features, module system changes, practical migration steps, common pitfalls, and best‑practice recommendations for enterprise backend development.
The article explains Go’s stack and heap memory, showing that stack allocations are fast, LIFO‑ordered and compile‑time sized while heap allocations grow upward, require garbage collection, and occur when variables escape a function, urging developers to prefer stack use for better performance.
This article explains the G1 garbage collector’s heap layout, collection cycles, pause prediction, log analysis, and monitoring tools, helping Java developers diagnose and resolve performance issues such as frequent restarts, OOM, CPU spikes, and periodic latency spikes.
This article reviews the major updates introduced in recent JDK releases, covering the shift from char[] to byte[] in String, expanded pattern‑matching in switch, removal of biased locking, G1 garbage‑collector evolution, JDK/JRE consolidation, generics specialization, and the addition of private methods in interfaces.
The article analyzes how hardware components, software mechanisms, and environmental conditions collectively impact NVMe SSD performance, explaining why real‑world results often differ from vendor specifications and highlighting the roles of NAND type, controller architecture, PCIe bandwidth, garbage collection, temperature, and wear‑leveling.
This guide explains why frequent garbage collection and heap memory overflow occur in Java applications, demonstrates how to reproduce the issue with a sample program, and walks through various techniques—including jmap histograms, heap dumps, VisualVM analysis, and remote JMX monitoring—to diagnose and resolve out‑of‑memory errors.
This article explains the internal structure of ThreadLocal, identifies scenarios where ThreadLocal can cause memory leaks—especially in thread‑pool environments—analyzes the root causes, and provides practical techniques such as using remove() and expungeStaleEntry() to avoid these leaks.
This article provides a comprehensive introduction to the Java Virtual Machine, covering its architecture, core principles, services such as garbage collection and security, and real‑world applications ranging from enterprise systems and Android apps to big‑data frameworks and game servers.
The G1 Garbage Collector, introduced in Java 7 update 4, replaces CMS by using a region‑based design that minimizes pause times and improves throughput, and a detailed video with diagrams and code examples is provided to deepen understanding of its operation.
This article explains the concept of memory leaks in Java applications, why they matter, how to identify common leak patterns and symptoms, and provides best practices, tools, and code examples for preventing, detecting, and resolving memory leaks to improve performance and stability.
This article explores JDK 21's major features including virtual threads, generational ZGC, and new APIs, comparing their performance with traditional threading models and demonstrating practical implementations in Spring Boot.
The default Java object hashCode() implementation is immutable and unchanged by garbage collection, while custom overrides must keep contributing fields constant to avoid map errors, and the OpenJDK native implementation stores the hash in the object header using a Marsaglia XORshift algorithm.
The article walks readers through building a custom scripting language from scratch—explaining compilation basics, lexical scanning, parsing, bytecode generation, and virtual‑machine execution—using a sample language called eben to illustrate BNF syntax, variable scopes, control flow, functions, closures, object‑orientation, garbage collection, and the historical evolution of programming languages.
This article provides a comprehensive overview of the Java Virtual Machine, detailing its core components such as the interpreter, class loader, and runtime, explaining its execution workflow from source code to bytecode and native code, and presenting practical optimization techniques for memory, garbage collection, and performance.
This article explains the Java Virtual Machine's memory architecture—including heap, method area, stack, program counter, and non‑heap memory—details common garbage‑collection algorithms such as mark‑sweep, copying, mark‑compact, and generational, and outlines Java's memory‑management practices like object lifecycle, memory partitioning, references, and synchronization.
This article details the motivation, steps, encountered challenges, and measurable performance gains of upgrading a high‑traffic search recommendation service from JDK 8 to JDK 17, highlighting new Java syntax, modern GC algorithms, deployment procedures, and the resulting reductions in latency, GC pause times, and heap usage.
ZGC, introduced in JDK 11, is a non‑generational, highly concurrent Java garbage collector that uses colored pointers and load barriers to achieve sub‑10 ms pause times—even on terabyte‑scale heaps—while limiting throughput loss to under 15 % through three brief stop‑the‑world phases and four concurrent phases.
This article recounts a production incident where a container's CPU spiked due to abnormal JVM garbage collection, walks through step-by-step diagnostics using top, jstack, and thread analysis, explains the root cause in an Excel export routine, and concludes with a brief promotion of a ChatGPT community.
This article provides a comprehensive overview of the Java Virtual Machine's runtime memory areas, object layout, garbage collection roots, marking algorithms, generational hypotheses, remembered sets, and the main GC algorithms such as Mark‑Sweep, Mark‑Copy, and Mark‑Compact, explaining their principles and trade‑offs.
This article documents a month‑long JVM garbage‑collection tuning process that reduced daily FullGC occurrences from over 40 to less than one per ten days by adjusting heap parameters, fixing memory leaks, and tuning Metaspace, while providing detailed analysis, code snippets, and performance graphs.
The article describes how vivo’s core music service reduced frequent garbage collections, long GC pauses, and RPC timeouts by switching to ParNew+CMS collectors, implementing fault‑transfer monitoring, optimizing large response objects, and adding non‑invasive payload checks, resulting in dramatically lower YGC/FGC frequencies and improved memory stability.
JVM OptimizationPerformance Tuningbackend development
This article explains the JVM's object creation process—including stack allocation, TLAB checks, Eden and Survivor spaces, and GC handling—and details the memory layout of Java objects, covering object headers, class pointers, array lengths, padding, and the effect of compressed oops on 32‑bit versus 64‑bit systems.
This guide summarizes JD.com’s extensive JDK8 garbage‑collector optimization experience, covering version requirements, how to select the right GC, core and collector‑specific parameter settings, logging configuration, and concrete methods to assess GC health for latency‑sensitive and throughput‑oriented workloads.
This article provides a comprehensive overview of the Java Virtual Machine's runtime data areas, detailing heap structure, generational memory, stack allocation, TLAB, escape analysis, and various garbage collection strategies, while offering practical code examples and configuration tips for optimal performance.
This article documents a month‑long JVM garbage‑collection tuning effort that lowered FullGC from around 40 daily occurrences to one every ten days, halved YoungGC time, identified and fixed a memory‑leak caused by anonymous inner‑class listeners, and refined heap and metaspace settings to improve overall server throughput.
This article provides a comprehensive overview of the eight Java garbage collectors, detailing their target heap generations, operational characteristics, configuration flags, and suitability for different application performance and latency requirements.
This article explains why JVM memory tuning is essential for high‑pay roles, outlines six practical steps—including GC monitoring, heap dump generation, analysis, and parameter adjustments—and provides detailed guidance on heap size, generation ratios, GC types, and thread stack settings to reduce Full GC frequency and improve application performance.
This article explains the concept of automatic garbage collection in Java, detailing the mark‑sweep‑compact process, the need for generational collection, and how objects move through Eden, Survivor, and Old generations, while also noting promotional links for further resources.