mudge / re2

Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python".
http://mudge.name/re2/
BSD 3-Clause "New" or "Revised" License
129 stars 13 forks source link

Modernize usage of Ruby's C extension API #116

Closed casperisfine closed 10 months ago

casperisfine commented 10 months ago

Use the TypedData API introduced in Ruby 1.9.2, instead of the old Data API that was deprecated in Ruby 2.3.

This allows to implement Write Barriers.

Write barrier protected objects are allowed to be promoted to the old generation, which means they only get marked on major GC, making minor GC faster.

The downside is that the RB_BJ_WRITE macro MUST be used to set references, otherwise the referenced object may be garbaged collected.

This also allow to implement GC compaction.

mudge commented 10 months ago

I also ran this through ruby_memcheck and no leaks were reported.