This article presents ten practical Python code examples demonstrating various garbage collection mechanisms and memory‑analysis tools, including reference counting, cyclic references, object inspection, tracemalloc, memory_profiler, pympler, and objgraph, to help developers understand and optimize memory usage.
From its inception as a simple game distribution platform to a sophisticated, multi‑layered recommendation architecture, this article details the background, early models, business growth, architectural evolution, caching strategies, GC optimization, rate limiting, experiment platform, multi‑path recall, dynamic tuning, and future intelligent enhancements of a game recommendation system.
This article explains the core trade‑offs of JVM tuning—short pause times versus high throughput—provides quantitative goals, outlines when tuning is needed, details step‑by‑step optimization procedures, and lists common GC strategies and command‑line parameters for effective Java performance tuning.
This article provides a concise yet comprehensive overview of the Java Virtual Machine, covering its core components, how Java source files are compiled and executed, class‑loader mechanisms, runtime memory areas, garbage‑collection algorithms, and practical JVM tuning parameters for optimal performance.
This article reviews the Java HotSpot memory model, explains when JVM tuning is needed, details common OutOfMemoryError scenarios with reproducible code, introduces built‑in monitoring utilities and third‑party tools, and provides practical tuning parameters and case studies for optimizing Java applications.
Java 21, slated for release on September 19, 2023 as the next LTS version after Java 17, will drop the experimental Generational Shenandoah garbage‑collector feature during its Ramp‑down phase due to insufficient readiness, with the change slated for removal by the June 14 review deadline.
This article compares the memory management and garbage collection architectures of Java and Go, detailing their heap and stack regions, GC trigger conditions, collection algorithms, fragmentation handling, root object selection, and write‑barrier strategies, and includes illustrative code examples.
An investigation of a 100k‑QPS Go monolith revealed that intermittent availability drops were caused by a memory‑leak in the third‑party gcache LFU implementation, which inflated GC work and produced long mark phases; upgrading gcache eliminated the leak and restored 0.999+ availability, highlighting the need for thorough observability and dependency monitoring.
This article compares the Shenandoah and ZGC garbage collectors introduced in OpenJDK, explaining their design goals, key differences from G1, core mechanisms such as connection matrices and forwarding or colored pointers, and detailing each collector’s concurrent phases to achieve pause times under 10 ms regardless of heap size.
The article examines Java's 27‑year history, comparing its performance, startup time, and memory usage against modern languages and cloud‑native demands, while detailing JDK feature releases, module system, garbage collectors, AOT compilation, virtual threads, value types, GraalVM, and emerging frameworks to assess Java's relevance today and tomorrow.
This article investigates why a Go‑based service health‑check system experiences high latency, examines differences from Nginx checks, runs experiments on physical machines and Docker, and explores goroutine scheduling, GOMAXPROCS, and garbage‑collection tuning to reduce average response time from 40 ms to under 10 ms.
This article deep‑dives into the LinkedBlockingQueue.dequeue implementation, revealing why the line h.next = h is essential for helping the garbage collector, how cross‑generation references affect GC performance, and the role of weakly‑consistent iterators in Java's concurrent queue.
The article details a Redis‑compatible, disk‑based KV service built atop TiKV using a compute‑storage split (Tula), describes custom key encoding and expiration mechanisms, and explains four optimization stages that introduce slot‑based hashing and adaptive concurrency to dramatically cut garbage‑collection latency while preserving write performance.
This article explores the evolution of Java garbage collectors—from the simple Serial and Parallel collectors to the concurrent CMS and region-based G1—detailing their algorithms, tuning parameters, strengths, weaknesses, and best‑practice recommendations for selecting the optimal collector based on workload and memory constraints.
This article provides a comprehensive overview of the WebAssembly runtime, detailing its binary format, module loading and validation, execution engine designs, linear memory layout, garbage‑collection proposals, and the WebAssembly System Interface (WASI), while illustrating each concept with diagrams and code examples.
This article provides a comprehensive technical analysis of the WebAssembly runtime architecture, detailing the module loading and parsing process, stack-based execution engines, linear memory management strategies, and the evolving garbage collection proposals, while also introducing the WebAssembly System Interface (WASI) for cross-platform system interactions.
JVM safepoints are pause points where the VM can stop all threads for operations like garbage collection; the article shows how counted loops can prevent threads from reaching safepoints, causing unexpected long sleeps, and explains tuning flags, loop‑counter changes, and best practices to avoid STW pauses.
This article provides a comprehensive overview of the JVM, covering its memory model, heap and stack structures, four garbage‑collection algorithms, seven collectors including G1 and ZGC, performance‑tuning steps, analysis tools, and guidance on obtaining the full series of resources.
The 2023 New Relic Java ecosystem report reveals that Java 17 usage jumped over 430% in a single year, Java 11 remains dominant, Amazon Corretto now leads JDK market share, containerized deployments hit 70%, and the G1 garbage collector stays the top choice among Java 11+ users.
This article explains the JVM's runtime memory structure—including the method area, heap, stacks, and program counter—details object memory layout, garbage collection roots, marking algorithms, generational models, and various GC algorithms such as mark‑sweep, mark‑copy, and mark‑compact, providing a comprehensive overview.
This article surveys the evolution of Java from JDK 8 to JDK 17, highlighting key JEPs, the module system, garbage‑collector innovations, diagnostic tools, and new language features, while offering practical migration advice and performance‑tuning tips for developers.
This article provides a detailed overview of JVM garbage collection, classifying the seven major collectors for young and old generations, explaining their algorithms, advantages, drawbacks, and common configuration flags for optimizing Java application performance.
When a production container suddenly hit 90% CPU, the author traced the issue to abnormal JVM garbage‑collection activity, captured the problematic GC graphs, and used Linux tools, jstack, and code inspection to pinpoint a faulty Excel export loop that caused excessive GC and full‑GC cycles.
This article examines frequent mistakes when using Java thread pools—such as improper creation, unreasonable parameters, unreleased local pools, and unsafe concurrent operations—and provides detailed analysis, configuration guidelines, and best‑practice recommendations to prevent memory leaks, deadlocks, and performance issues.
This article presents six practical Go performance optimizations—including GOMAXPROCS tuning for Kubernetes, struct field ordering, garbage‑collection limits, zero‑copy unsafe conversions, jsoniter usage, and sync.Pool pooling—that together can dramatically lower CPU, memory, and latency in production services.
This article presents a comprehensive, step‑by‑step guide on estimating capacity, selecting and configuring garbage collectors, sizing heap, young and survivor spaces, tuning thread stacks, and adding diagnostic options for a Java service that must handle one million login requests per day on a server with 8 GB of memory.
This article walks through a step‑by‑step approach to sizing JVM heap, young generation, GC selection, and related parameters for a platform handling one million login requests per day on a node with 8 GB memory, providing practical formulas, example configurations, and tuning tips.
This article presents a step‑by‑step guide on how to size and configure JVM parameters—including heap, young generation, stack, GC selection, and Metaspace—to reliably support a platform that processes one million login requests per day on a server with 8 GB of memory.
This article explains a step‑by‑step methodology for estimating capacity, selecting appropriate garbage collectors, sizing JVM memory regions, and tuning advanced parameters such as survivor ratio, tenuring threshold, and Metaspace to reliably support a login service that processes one million requests per day on a machine with 8 GB of RAM.
This article explains the fundamentals of Java garbage collection, detailing classic algorithms such as reference counting, reachability analysis, mark‑sweep, copying, mark‑compact, and generational collectors, then introduces modern collectors like Serial, Parallel, CMS, G1, and the low‑latency ZGC, highlighting their mechanisms, advantages, and drawbacks.
This article details the systematic reduction of memory consumption for Ctrip's hotel query service by halving container memory, evaluating and tuning modern garbage collectors, diagnosing off‑heap leaks, and ultimately replacing the default ptmalloc allocator with jemalloc to achieve stable performance and lower resource costs.
This article walks through a systematic approach to sizing and configuring JVM parameters—including heap, young generation, GC algorithm, Metaspace, and safety‑point settings—for a high‑traffic login service that receives one million requests per day on a server with 8 GB of memory, providing both practical code examples and interview‑style explanations.
This article walks through a systematic approach to sizing and configuring JVM memory and garbage‑collector parameters for a service handling one million login requests per day on an 8 GB server, covering capacity planning, GC selection, heap region sizing, thread‑stack settings, dynamic age thresholds, large‑object handling, and diagnostic options such as heap dumps and GC logging.
This article dives deep into the OpenJDK G1 FullGC implementation, explaining its architecture, trigger conditions, preparation steps, and the four‑phase collection process while comparing single‑threaded and multi‑threaded implementations in JDK 8 and JDK 11, and highlighting code paths that can cause long GC pauses.
This guide explains how to use Java's java.lang.management APIs to retrieve real-time JVM CPU usage, system load averages, garbage collection details, and heap/non‑heap memory statistics, providing code snippets and practical usage scenarios for performance testing and resource allocation.
ZGC, the Z Garbage Collector introduced in JDK 11, is a low‑latency, region‑based JVM garbage collector that uses colored pointers, load barriers, and multi‑mapping to achieve sub‑10 ms pause times across heap sizes up to several terabytes, with concurrent marking, relocation, and three brief STW phases.
CPython’s garbage collector combines reference counting with a cyclic collector that uses generational strategies, fat pointers, and optimized object structures to efficiently identify and reclaim unreachable objects, handling cycles, weak references, and memory layout details while minimizing overhead.
In a reClojure 2022 keynote, Java’s creator James Gosling discussed how Java underpins AWS’s core services, the massive team optimizing its garbage collection, his love for functional programming, the challenges of turning research into practice, and his confidence in Oracle’s current stewardship of the language.
The article explains how the JVM executes Java bytecode, detailing bytecode structure, lambda compilation, JIT tiers and optimizations such as inlining and escape analysis, describes runtime memory areas and generational garbage collectors—including G1, ZGC, and Shenandoah—and offers key tuning flags for balancing throughput, latency, and heap size.
This article explains what constitutes garbage in the Java heap, compares reference‑counting and root‑reachability approaches, demonstrates a reference‑counting example, and reviews the main garbage‑collection algorithms and collectors (Serial, ParNew, Parallel Scavenge, Serial Old, Parallel Old, CMS, G1) used by modern JVMs.
This article introduces the four main JVM garbage collection algorithms—Mark‑Sweep, Copying, Mark‑Compact, and Generational collection—explaining their mechanisms, suitable scenarios, advantages, and drawbacks, and summarizing how they are applied to young and old generations in modern Java virtual machines.
This article analyzes a midnight HDFS DataNode failure caused by excessive GC and OOM due to Spark batch jobs, examines how an unexpected surge in block count overloaded default memory settings, and presents concrete remediation steps and optimization recommendations to stabilize the cluster.
This article provides a comprehensive overview of the Java Virtual Machine memory architecture, covering heap layout, object allocation, Metaspace, stack frames, native method stacks, program counters, direct memory, and code cache, complete with configuration tips and practical code examples.
This article explains how JVM memory management and various garbage collection algorithms affect Spark task performance, covering JVM fundamentals, GC concepts, common collectors, and practical tuning strategies to avoid full GC pauses and improve throughput.
Explore comprehensive JVM performance optimization, covering memory architecture, key tuning flags, garbage collector selection, common OOM scenarios, and essential monitoring tools such as jstack, jstat, JConsole, and VisualVM, with practical examples and code snippets to help you diagnose and resolve memory issues.
Oracle’s Enterprise Performance Pack, offered free to Java SE subscribers and OCI users, brings Java 17‑level memory management and performance enhancements—including modern garbage collection, compact strings, and improved observability—to legacy Java 8 applications, delivering up to 40% better memory and CPU efficiency under heavy loads.
This article details the investigation of a 2% timeout rate in a billion‑request‑per‑day ticket pricing service, identifies GC‑induced stop‑the‑world pauses as the main cause, and demonstrates how switching from ParNew+CMS to G1 and finally to ZGC dramatically reduces latency and timeout rates.
This article provides an in‑depth explanation of the JVM memory model, detailing heap, method area, stacks, direct memory, various garbage‑collection algorithms, collector types, and common JVM tuning parameters for performance optimization.
This article explains why non‑static inner classes in Java retain references to their outer class, causing memory leaks and eventual OutOfMemoryError, and demonstrates practical solutions such as avoiding references or converting the inner class to a static one, illustrated with code examples and debugging screenshots.
This article examines a puzzling 'prevent gc' comment in RocketMQ source, explains how inserting Thread.sleep(0) creates a JVM safepoint to avoid long GC pauses, explores counted vs uncounted loops, and demonstrates practical code modifications to improve performance.
This article explains how Apache BookKeeper's garbage collection works, detailing minor and major GC triggers, compression strategies, entry log size management, usage calculations, and provides a step‑by‑step code analysis of the GarbageCollectorThread implementation.
This article explains how Kubernetes' kubelet performs container and image garbage collection, details the configurable thresholds and limits, and presents step‑by‑step experiments that demonstrate the impact of different settings on image and container cleanup behavior.
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.
This article outlines the major new features of PHP 8 and PHP 7, explains why PHP 7 outperforms PHP 5, describes the execution flow, web‑request lifecycle, underlying architecture, data structures, garbage‑collection mechanism, and the PHP‑FPM master‑worker model with optimization tips.
This article explains how the V8 JavaScript engine manages memory through stack and heap allocation, describes its generational garbage‑collection architecture—including New Space, Old Space, and various GC algorithms—and offers practical optimization techniques to reduce pause times and improve performance.
This article explains the JVM memory layout, covering the heap (including Xms/Xmx tuning, Young/Old generations, and garbage collection), Metaspace versus PermGen, the thread‑private JVM stack and native method stack, and the program counter register, with practical code examples.
This article explains the JVM memory layout, covering the heap (young and old generations), Metaspace, virtual machine stacks, native method stacks, and the program‑counter register, while describing their roles, configuration parameters and how they interact during garbage collection and method execution.
This article demystifies the JVM’s runtime data areas and illustrates, with a simple Java example and animation, how a program’s bytecode is executed—from the program counter and stack frames to heap allocation and garbage collection—providing a clear, step‑by‑step view of Java execution.
Since JDK 8, HotSpot’s garbage collectors have undergone extensive refinements—introducing G1 as default, adding ZGC and Shenandoah, and optimizing Parallel GC—resulting in notable gains in throughput, reduced pause latency, and lower auxiliary memory usage, as demonstrated by SPECjbb2015 benchmarks across JDK 8 to JDK 18.
Based on Google’s TCMalloc, Go’s automatic memory system organizes memory into pages and spans, uses per‑processor mcache and shared mcentral for size‑class allocation, and employs a concurrent tri‑color mark‑sweep garbage collector triggered by heap usage or large allocations, illustrating the full allocation‑to‑reclamation pipeline.
This article explains how the Java Virtual Machine achieves write‑once‑run‑anywhere by abstracting platform differences, then details the JVM’s internal components—including the class‑loader subsystem, runtime data areas such as heap, stack, method area, and program counter—followed by code examples and analysis of object layout, pointer compression, and memory allocation strategies.
This article explains ZGC’s evolution from an experimental feature in JDK 11 to a production‑ready collector in JDK 15, detailing its sub‑10 ms pause guarantee, memory‑mapping architecture, colored pointers, region layout, read barriers, and the multi‑phase concurrent collection process that together deliver low‑latency, high‑throughput garbage collection for Java applications.
This article explains the JVM memory architecture, covering the heap (young and old generations, Eden and Survivor spaces), Metaspace, virtual machine stacks, native method stacks, and the program counter register, while also illustrating key JVM parameters and bytecode execution with examples.
This article provides a comprehensive overview of JVM memory layout, explains major garbage‑collection algorithms and collectors, details how different memory regions cooperate, and offers practical tuning steps and tool usage for diagnosing GC issues in Java applications.
This article explains Java constructors, the importance of providing a no‑arg constructor, method overloading rules and type promotion, the use of the this and static keywords, memory cleanup strategies, garbage‑collector algorithms, JIT compilation, member initialization order, and enum usage with clear code examples.
hyengine is a lightweight, high‑performance mobile execution engine that unifies WebAssembly, JavaScript, Python and Lua via a compiler and VM, offering JIT compilation, register allocation, inline‑cache optimizations, a custom allocator (hymalloc) and a concurrent three‑color garbage collector (hygc), achieving substantial speed‑ups on macOS and Android.
The 2022 Java ecosystem report reveals Java 11 surpassing Java 8 as the dominant runtime, highlights the modest adoption of non‑LTS releases like Java 14, shows Oracle’s market share shrinking while Amazon rises, and examines how container‑based deployments affect CPU, memory, and garbage‑collector choices.
ZGC (Z Garbage Collector) is a scalable, low‑latency collector introduced in JDK 11, featuring sub‑millisecond pause times, region‑based memory layout, colored pointers, NUMA awareness, and concurrent phases, with detailed explanations of its architecture, parameters, triggers, and log analysis.
ZGC, introduced in JDK 11 and stabilized in JDK 15, is a low‑latency, region‑based, concurrent garbage collector that aims for sub‑millisecond pause times regardless of heap size, leveraging colored pointers, NUMA awareness, multi‑mapping, and read barriers to achieve efficient memory reclamation.
This article explains JavaScript's memory lifecycle, defines memory leaks, enumerates typical leak patterns such as accidental globals, timers, closures and DOM references, and describes the underlying garbage‑collection strategies (mark‑and‑sweep and reference counting) together with practical mitigation techniques.
This article demystifies JavaScript closures, explains how V8 builds scope chains and closure objects during compilation, and demonstrates why closures can cause memory leaks by retaining references, illustrated with multiple runnable code examples and practical debugging tips.
This article introduces hyengine, a lightweight, high‑performance engine designed to run multiple scripting languages such as JavaScript, WebAssembly, and Python on mobile devices, detailing its architecture, JIT compilation, optimizer passes, memory allocator, garbage collector, and performance benchmarks compared to LLVM and other runtimes.
This article explains the complete lifecycle of Java object creation, covering the JVM's handling of the new bytecode, class loading, memory allocation strategies such as pointer bumping and free lists, object header structure, layout, and tools for inspecting object memory.
This article explains the inner workings of Java's CMS and G1 garbage collectors, detailing their four-phase processes, the need for stop‑the‑world pauses, strategies like incremental update and SATB to handle missed marks, and compares their advantages, drawbacks, and suitable replacement scenarios.
Explore the structure of Java's memory regions—including the program counter, stacks, heap, and method area—along with allocation algorithms, object layout, garbage collection roots, and common pitfalls such as memory leaks and StackOverflowError, providing a comprehensive guide for JVM developers.
This article explains Java garbage collection fundamentals, covering why GC is needed, how it works, reference types, major collection algorithms, generational strategies, specific collectors like CMS and G1, and practical tuning and allocation rules for JVM memory management.
This article explains the JEP 423 proposal to fix regions in the G1 garbage collector, allowing Java threads to avoid pauses during JNI critical sections and reducing GC latency, while discussing implementation details, potential heap exhaustion risks, and upcoming JDK release timelines.
This newsletter curates a collection of technical articles covering WebAssembly's future, Deno's 2021 progress, JavaScript garbage collection fundamentals, front‑end debugging best practices, modern CSS color systems, FormData usage, and advanced JavaScript features like iterators and generators.
The article explains how JavaScript engines store variables in stack and heap memory, clarifies why const primitives are immutable while object properties can change, shows that new objects reside in heap, and discusses allocation efficiency and garbage‑collection behavior of both memory regions.
The article thoroughly explains Android ART’s Concurrent Copying (CC) garbage collector—its terminology, correctness and progress requirements, engineering challenges, classic and Android‑specific algorithms, region‑based design with bump‑pointer allocation, performance benefits such as 32% lower heap usage and sub‑millisecond pauses, and its trade‑offs including doubled reserved heap space and migration overhead.
This article explains the theory behind JVM garbage collection algorithms, details various collectors such as Serial, Parallel, CMS, and G1, compares their strengths and weaknesses, and explores advanced concepts like three‑color marking, write barriers, SATB, and memory management parameters.
This article provides a comprehensive overview of the Java Virtual Machine, covering its core responsibilities, runtime memory layout, class‑loading process, object allocation and layout, garbage‑collection theories and algorithms, common collectors, useful JVM tools, and tuning parameters.
This article explains the JVM runtime memory areas, the fundamentals of garbage collection, generational heap organization, and the characteristics of major GC collectors, providing practical insights and optimization tips for Java developers seeking to understand and improve JVM performance.
This article explains Python's automatic garbage collection, covering reference counting, the mark-and-sweep algorithm, generational collection, default thresholds, and when to disable or adjust the collector for performance‑critical code.
The article details three Xianyu backend incidents where Full GC pauses caused latency spikes or outages, analyzes root causes ranging from survivor space shortage and mis‑tuned CMS to oversized async Log4j events and massive string‑concatenation logs, and presents remediation steps such as switching to G1GC, adjusting Log4j settings, and using parameterized logging to eliminate the pauses.
Over a month we reduced Full GC occurrences from around 40 times per day to roughly one every ten days by systematically adjusting JVM parameters, addressing memory leaks, and fine‑tuning metaspace and young generation settings, ultimately achieving lower GC pause times and higher server throughput.
This article explains how Go's garbage collection has progressed from the simple stop‑the‑world mark‑and‑sweep algorithm in Go 1.3, through the tri‑color concurrent marking with insert and delete write barriers in Go 1.5, to the hybrid write‑barrier approach introduced in Go 1.8 that dramatically reduces pause times while preserving memory safety.
This comprehensive guide explains the JVM memory model, details each memory region, compares major garbage‑collection algorithms, and lists essential JVM tuning parameters for optimal Java performance.
This article explains how Vue 3 uses a WeakMap as a cache to avoid duplicate proxies, why WeakMap is preferred over Map for memory‑safe reactive objects, and explores WeakMap fundamentals, its methods, garbage‑collection strategies, and practical applications such as DOM storage and private class fields.
This comprehensive guide explores the inner workings of the Java Virtual Machine, covering memory regions, garbage‑collection algorithms, class‑file structure, bytecode instructions, class loading mechanisms, and method dispatch strategies, providing clear explanations and code examples for developers seeking a deeper understanding of JVM fundamentals.
This article explains how Python’s automatic garbage collection works, covering reference counting, the problems of cyclic references, the mark‑and‑sweep algorithm, generational collection, default thresholds, and when and how to manually control the collector with code examples.
This article explains how the V8 JavaScript engine allocates memory, why garbage collection is necessary, describes the memory layout of new and old generations, reviews common GC algorithms such as reference counting, mark‑sweep, mark‑compact and incremental marking, and offers practical tips for writing high‑performance JavaScript code.
This article explains the difference between memory leaks and overflow, whether young GC triggers stop‑the‑world pauses, distinguishes major GC from full GC, and describes Java's direct memory usage, providing clear insights into Java memory management and performance considerations.
This article provides an in-depth exploration of Java's JVM memory architecture, garbage collection algorithms, class file structure, class loading process, bytecode execution, and method dispatch mechanisms, offering practical code examples and visual diagrams to help developers understand and optimize JVM performance.
This comprehensive guide explains the JVM memory layout, class‑loading and object‑creation process, the parent‑delegation model, various garbage‑collection algorithms and collectors, GC roots, triggers for YGC and Full GC, and practical tuning parameters to improve Java application performance.
This article provides a comprehensive, interview‑focused guide to the Java Virtual Machine, covering memory regions, garbage‑collection algorithms, reference types, GC roots, STW pauses, OopMap, safe points, stack overflow, class loading, the parent‑delegation model, stack allocation, and object layout, all with clear explanations and diagrams.
By replacing the default Parallel GC with a ParNew‑CMS collector, enlarging the Young generation, fixing Metaspace settings, and tuning CMS occupancy thresholds, the video service cut Young and Full GC pauses dramatically, lowered Full GC count by over 80%, and achieved more than 30% P99 latency reduction, with some APIs improving up to 80%.