Garbage-Collector Write Barrier¶
A garbage-collector write barrier accompanies selected reference updates with bookkeeping that preserves a collector invariant.
Core Idea¶
A garbage-collector write barrier is bookkeeping associated with selected mutations of a managed object graph, so the collector retains the information required by its collection algorithm. It may run before or after a reference update, and may record a location, an old referent, or other collector-specific information. Its exact checks and actions depend on the collector; a compiler can sometimes prove that a particular store needs no check.[1][2]
How would you explain it like I'm…
Notes for the Cleanup Helper
Telling the Memory Cleaner About Changes
Bookkeeping on Reference Updates
Structural Signature¶
A mutator changes a reference; the collection algorithm relies on an invariant about reachability or cross-region references; the barrier maintains or records information affected by that mutation; the collector later uses that information. A false negative can hide a live reference from the relevant collection, whereas extra remembered information may increase scanning work.[1][2]
Worked Examples¶
Generational store check. Hölzle describes a generational collector in which the remembered set contains locations potentially holding references from older objects to younger ones. When a store creates an old-to-young reference, its location must be remembered so young objects can be collected without scanning the entire old generation. The paper notes that a compiler can omit checks for stores it can prove irrelevant.[1]
G1 concurrent marking. Oracle's 2013 description of the HotSpot G1 collector says a pre-write barrier records and marks objects belonging to the logical snapshot used in concurrent marking. The same description separately identifies a post-write barrier used to record heap changes for region remembered sets. The two actions support different parts of that collector; neither is a universal prescription for all collectors.[2]
Boundaries and Practical Use¶
This barrier is not a CPU write-memory barrier or fence, which orders specified memory operations under a memory model. Nor does a collector write barrier alone ensure that storage writes reach durable media in a particular order. Similar names designate different mechanisms and invariants. The necessary barrier points, optimization and synchronization must be checked against the actual collector and runtime.[3][2]
Neighborhood in Abstraction Space¶
Garbage-Collector Write Barrier sits in a sparse region of the domain-specific corpus (99th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.
Family — Unclustered & Miscellaneous (3155 abstractions)
Nearest neighbors
- Weak reference — 0.74
- Phantom reference — 0.74
- Particle Filter — 0.73
- Oblivious Data Structures: Representation and Execution — 0.73
- Gold-Standard Erosion — 0.72
Computed from structural-signature embeddings · 2026-11-14
References¶
[1] Urs Hölzle, A Fast Write Barrier for Generational Garbage Collectors, OOPSLA '93 Workshop on Garbage Collection, October 1993, author project bibliography and abstract, https://bibliography.selflanguage.org/write-barrier.html. registry ↩a ↩b ↩c
[2] Monica Beckwith, “Garbage First Garbage Collector Tuning,” Oracle, August 2013, https://www.oracle.com/java/technologies/g1gc.html. registry ↩a ↩b ↩c ↩d
[3] Linux kernel documentation, “Ordering,” Linux Kernel Memory Model, https://docs.kernel.org/dev-tools/lkmm/docs/ordering.html. registry ↩