From 4e196af17c334de1eb74f7bb036fec12a35b794e Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sun, 1 Feb 2026 21:19:10 +0100 Subject: [PATCH 1/2] Use ruby_sized_xfree --- box.c | 2 +- marshal.c | 2 +- re.c | 4 ++-- scheduler.c | 19 +++---------------- variable.c | 2 +- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/box.c b/box.c index 830172cdd52345..bfb6f51346be8f 100644 --- a/box.c +++ b/box.c @@ -271,7 +271,7 @@ box_entry_free(void *ptr) cleanup_all_local_extensions(box->ruby_dln_libmap); box_root_free(ptr); - xfree(ptr); + SIZED_FREE(box); } static size_t diff --git a/marshal.c b/marshal.c index 1a9e817872eb02..e2a0ce6dd10210 100644 --- a/marshal.c +++ b/marshal.c @@ -2350,7 +2350,7 @@ r_object(struct load_arg *arg) static void clear_load_arg(struct load_arg *arg) { - xfree(arg->buf); + ruby_sized_xfree(arg->buf, BUFSIZ); arg->buf = NULL; arg->buflen = 0; arg->offset = 0; diff --git a/re.c b/re.c index 82e9407a0a85ca..0e169694d4e536 100644 --- a/re.c +++ b/re.c @@ -1023,7 +1023,7 @@ update_char_offset(VALUE match) num_regs = rm->regs.num_regs; if (rm->char_offset_num_allocated < num_regs) { - REALLOC_N(rm->char_offset, struct rmatch_offset, num_regs); + SIZED_REALLOC_N(rm->char_offset, struct rmatch_offset, num_regs, rm->char_offset_num_allocated); rm->char_offset_num_allocated = num_regs; } @@ -1101,7 +1101,7 @@ match_init_copy(VALUE obj, VALUE orig) if (RMATCH_EXT(orig)->char_offset_num_allocated) { if (rm->char_offset_num_allocated < rm->regs.num_regs) { - REALLOC_N(rm->char_offset, struct rmatch_offset, rm->regs.num_regs); + SIZED_REALLOC_N(rm->char_offset, struct rmatch_offset, rm->regs.num_regs, rm->char_offset_num_allocated); rm->char_offset_num_allocated = rm->regs.num_regs; } MEMCPY(rm->char_offset, RMATCH_EXT(orig)->char_offset, diff --git a/scheduler.c b/scheduler.c index b23ddad41e70cc..c2f370a22aee4e 100644 --- a/scheduler.c +++ b/scheduler.c @@ -77,19 +77,6 @@ struct rb_fiber_scheduler_blocking_operation { volatile rb_atomic_t status; }; -static void -blocking_operation_mark(void *ptr) -{ - // No Ruby objects to mark in our struct -} - -static void -blocking_operation_free(void *ptr) -{ - rb_fiber_scheduler_blocking_operation_t *blocking_operation = (rb_fiber_scheduler_blocking_operation_t *)ptr; - ruby_xfree(blocking_operation); -} - static size_t blocking_operation_memsize(const void *ptr) { @@ -99,11 +86,11 @@ blocking_operation_memsize(const void *ptr) static const rb_data_type_t blocking_operation_data_type = { "Fiber::Scheduler::BlockingOperation", { - blocking_operation_mark, - blocking_operation_free, + NULL, // nothing to mark + RUBY_DEFAULT_FREE, blocking_operation_memsize, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE }; /* diff --git a/variable.c b/variable.c index ce1873560fcb26..dfd1dfc3c48160 100644 --- a/variable.c +++ b/variable.c @@ -1890,7 +1890,7 @@ rb_ensure_iv_list_size(VALUE obj, uint32_t current_len, uint32_t new_capacity) RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj)); if (FL_TEST_RAW(obj, ROBJECT_HEAP)) { - REALLOC_N(ROBJECT(obj)->as.heap.fields, VALUE, new_capacity); + SIZED_REALLOC_N(ROBJECT(obj)->as.heap.fields, VALUE, new_capacity, current_len); } else { VALUE *ptr = ROBJECT_FIELDS(obj); From 198b52f5ad099f0ec9b9b64add9ed3e23e6bdc33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Feb 2026 15:13:33 +0000 Subject: [PATCH 2/2] [ruby/rubygems] Bump the rb-sys group across 2 directories with 1 update Bumps the rb-sys group with 1 update in the /test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib directory: [rb-sys](https://github.com/oxidize-rb/rb-sys). Bumps the rb-sys group with 1 update in the /test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example directory: [rb-sys](https://github.com/oxidize-rb/rb-sys). Updates `rb-sys` from 0.9.123 to 0.9.124 - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.123...v0.9.124) Updates `rb-sys` from 0.9.123 to 0.9.124 - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.123...v0.9.124) --- updated-dependencies: - dependency-name: rb-sys dependency-version: 0.9.124 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rb-sys - dependency-name: rb-sys dependency-version: 0.9.124 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: rb-sys ... Signed-off-by: dependabot[bot] https://github.com/ruby/rubygems/commit/0370d78f5d --- .../custom_name/ext/custom_name_lib/Cargo.lock | 8 ++++---- .../custom_name/ext/custom_name_lib/Cargo.toml | 2 +- .../rust_ruby_example/Cargo.lock | 8 ++++---- .../rust_ruby_example/Cargo.toml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock index a5051607c15957..d7638709b5d491 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock +++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock @@ -152,18 +152,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.123" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fb1a185af97ee456f1c9e56dbe6e2e662bec4fdeaf83c4c28e0e6adfb18816" +checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.123" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58ebd02d7a6033e6a5f6f8d150c1e9f16506039092b84a73e6bedce6d3adf41" +checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3" dependencies = [ "bindgen", "lazy_static", diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml b/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml index 42ac3497a66b14..223b8abd47c2d2 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml +++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -rb-sys = "0.9.123" +rb-sys = "0.9.124" diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock index efc85ffd5fcbf0..6c41c44c45e403 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock @@ -145,18 +145,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.123" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45fb1a185af97ee456f1c9e56dbe6e2e662bec4fdeaf83c4c28e0e6adfb18816" +checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.123" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58ebd02d7a6033e6a5f6f8d150c1e9f16506039092b84a73e6bedce6d3adf41" +checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3" dependencies = [ "bindgen", "lazy_static", diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml index 6972bb51750cdf..f1699f2b16e3e2 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -rb-sys = "0.9.123" +rb-sys = "0.9.124"