summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-04-23 16:32:45 -0400
committerPeter Zhu <[email protected]>2024-04-24 15:30:43 -0400
commit214811974becee9960b77e60b2b667068755304d (patch)
tree38e7e097ca68b136862464a3bd76c1f9338c9548 /vm.c
parent4349c7909f5c3e493e991f26c21bc22ec5bdac8f (diff)
Add ruby_mimcalloc
Many places call ruby_mimmalloc then MEMZERO. This can be reduced by using ruby_mimcalloc instead.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/vm.c b/vm.c
index 9bcde9ef2f..646b92accf 100644
--- a/vm.c
+++ b/vm.c
@@ -3301,7 +3301,6 @@ vm_default_params_setup(rb_vm_t *vm)
static void
vm_init2(rb_vm_t *vm)
{
- MEMZERO(vm, rb_vm_t, 1);
rb_vm_living_threads_init(vm);
vm->thread_report_on_exception = 1;
vm->src_encoding_index = -1;
@@ -4237,15 +4236,14 @@ void
Init_BareVM(void)
{
/* VM bootstrap: phase 1 */
- rb_vm_t * vm = ruby_mimmalloc(sizeof(*vm));
- rb_thread_t * th = ruby_mimmalloc(sizeof(*th));
+ rb_vm_t *vm = ruby_mimcalloc(1, sizeof(*vm));
+ rb_thread_t *th = ruby_mimcalloc(1, sizeof(*th));
if (!vm || !th) {
fputs("[FATAL] failed to allocate memory\n", stderr);
exit(EXIT_FAILURE);
}
// setup the VM
- MEMZERO(th, rb_thread_t, 1);
vm_init2(vm);
rb_vm_postponed_job_queue_init(vm);