From: "fuzzyrichie-gusto (Richard Desmarais) via ruby-core" Date: 2026-11-21T02:09:47+00:00 Subject: [ruby-core:127654] [Ruby Feature#22613] iseq freeing after require/load without reference Issue #22613 has been updated by fuzzyrichie-gusto (Richard Desmarais). Fair point - I went and did the GC-approach and made it default, so hopefully this works much better for the reusability part of things. ---------------------------------------- Feature #22613: iseq freeing after require/load without reference https://bugs.ruby-lang.org/issues/22613#change-120169 * Author: fuzzyrichie-gusto (Richard Desmarais) * Status: Open ---------------------------------------- When Ruby loads a file, it compiles the code into bytecode. The code at the top of each file and inside class bodies only ever runs once - while the file loads. Today Ruby keeps that one-time bytecode in memory forever, because a single block created inside a class (like a sig { } or a scope -> { }) keeps the whole file's compiled code alive. The change frees that bytecode right after each file finishes loading, keeping only the small bits that surviving blocks still need, which cuts memory for compiled code by about 40% in our app. This would be an opt-in feature - not a default. That being said, if the value is there to keep it, that's fine too - this just lets those who want the memory win to apply it. https://github.com/ruby/ruby/pull/20059 is the PR. I'm going to run it with a build as default-on to see what fails - which will help me fix any issues that arise - but will then put it back to opt-in. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/