# Write Barriers

DevFeed: [Write Barriers](<https://devfeed.tech/articles/write-barriers-31811.md>)

Original publisher: [Read original article](<https://patshaughnessy.net/2025/2/18/write-barriers>)

Author: Pat Shaughnessy

Published: 2025-02-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pat Shaughnessy](<https://devfeed.tech/sources/pat-shaughnessy.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [beautiful](<https://devfeed.tech/tags/beautiful.md>), [code](<https://devfeed.tech/tags/code.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [updating-ruby-under-a-microscope](<https://devfeed.tech/tags/updating-ruby-under-a-microscope.md>)

## AI overview

This tutorial explains Ruby write barriers in incremental and generational garbage collection. Write barriers detect writes to arrays, hashes, and other data structures that may add objects requiring marking; when triggered, Ruby moves the modified object back onto the mark stack for processing during a later garbage-collection step.

## Source excerpt

I've started working on a new edition of Ruby Under a Microscope that covers Ruby 3.x. I'm working on this in my spare time, so it will take a while. Leave a comment or drop me a line and I'll email you when it's finished. Ruby's garbage col