Project

General

Profile

Actions

Feature #22613

open

iseq freeing after require/load without reference

Feature #22613: iseq freeing after require/load without reference

Added by fuzzyrichie-gusto (Richard Desmarais) about 15 hours ago. Updated about 11 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:127646]

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

Also available in: PDF Atom