diff options
| -rw-r--r-- | box.c | 2 | ||||
| -rw-r--r-- | marshal.c | 2 | ||||
| -rw-r--r-- | re.c | 4 | ||||
| -rw-r--r-- | scheduler.c | 19 | ||||
| -rw-r--r-- | variable.c | 2 |
5 files changed, 8 insertions, 21 deletions
@@ -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 @@ -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; @@ -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 b23ddad41e..c2f370a22a 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 ce1873560f..dfd1dfc3c4 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); |
