Skip to content

Commit 1c7e19f

Browse files
committed
rb_free_tmp_buffer: use ruby_sized_xfree
We know the buffer length, we might as well feed that information back to the GC.
1 parent 3164d4e commit 1c7e19f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

imemo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ rb_free_tmp_buffer(volatile VALUE *store)
9494
rb_imemo_tmpbuf_t *s = (rb_imemo_tmpbuf_t*)ATOMIC_VALUE_EXCHANGE(*store, 0);
9595
if (s) {
9696
void *ptr = ATOMIC_PTR_EXCHANGE(s->ptr, 0);
97+
long cnt = s->cnt;
9798
s->cnt = 0;
98-
ruby_xfree(ptr);
99+
ruby_sized_xfree(ptr, sizeof(VALUE) * cnt);
99100
}
100101
}
101102

0 commit comments

Comments
 (0)