rb_free_tmp_buffer: use ruby_sized_xfree

We know the buffer length, we might as well feed that information
back to the GC.
This commit is contained in:
Jean Boussier 2026-01-16 20:37:42 +01:00
parent 3164d4e8a2
commit 1c7e19f961
Notes: git 2026-01-16 20:11:47 +00:00

View File

@ -94,8 +94,9 @@ rb_free_tmp_buffer(volatile VALUE *store)
rb_imemo_tmpbuf_t *s = (rb_imemo_tmpbuf_t*)ATOMIC_VALUE_EXCHANGE(*store, 0);
if (s) {
void *ptr = ATOMIC_PTR_EXCHANGE(s->ptr, 0);
long cnt = s->cnt;
s->cnt = 0;
ruby_xfree(ptr);
ruby_sized_xfree(ptr, sizeof(VALUE) * cnt);
}
}