From 6c92d5b7814aa74f476a90f40c33bab4e3d44bd7 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 2 Oct 2026 00:47:44 +0900 Subject: [PATCH] Release ALLOCV buffer Release `ALLOCV` buffers promptly when they are no longer needed. --- compile.c | 1 + prism_compile.c | 3 +++ string.c | 5 +++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compile.c b/compile.c index d719764b150..36fa8de1f61 100644 --- a/compile.c +++ b/compile.c @@ -13732,6 +13732,7 @@ ibf_dump_outer_variables(struct ibf_dump *dump, const rb_iseq_t *iseq) ibf_dump_write_small_value(dump, ibf_dump_id(dump, id)); ibf_dump_write_small_value(dump, val); } + ALLOCV_END(buff); } return offset; diff --git a/prism_compile.c b/prism_compile.c index b25e31bc51b..3a46485cdad 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -6941,6 +6941,9 @@ pm_compile_scope_node(rb_iseq_t *iseq, pm_scope_node_t *scope_node, const pm_nod keyword->table = (ID *)&ISEQ_BODY(iseq)->local_table[keyword_start_index]; } + local_table_for_iseq = NULL; + if (idtmp) ALLOCV_END(idtmp); + //********STEP 5************ // Goal: compile anything that needed to be compiled if (optionals_list && optionals_list->size) { diff --git a/string.c b/string.c index 63ea40f78cb..741d5a62a4e 100644 --- a/string.c +++ b/string.c @@ -4093,8 +4093,6 @@ rb_str_append_as_bytes(int argc, VALUE *argv, VALUE str) break; } - RB_GC_GUARD(t0); - clear_cr: // If no fast path was hit, we clear the coderange. // append_as_bytes is predominantly meant to be used in @@ -4104,6 +4102,7 @@ rb_str_append_as_bytes(int argc, VALUE *argv, VALUE str) // situations. ENC_CODERANGE_CLEAR(str); keep_cr: + ALLOCV_END(t0); return str; } @@ -9950,6 +9949,8 @@ tr_trans_pairs(VALUE str, VALUE pairs_val) } } + ALLOCV_END(pairs_handle); + if (!modify) { return Qnil; }