Actions
Feature #22613
openiseq freeing after require/load without reference
Feature #22613:
iseq freeing after require/load without reference
Status:
Open
Assignee:
-
Target version:
-
Description
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 a default change.
https://github.com/ruby/ruby/pull/20059 is the PR.
Actions