Skip to content

Commit c7c8797

Browse files
Remove mark maybe from imemo_tmpbuf
If `xcalloc` is used instead of `xmalloc` for `imemo_tmpbuf`, then calling `rb_gc_mark_locations` on the internals of the `imemo_tmpbuf` is no longer necessary. The main goal is to avoid mark maybe / mark and pin on objects where it isn't actually required. This is required for MMTk moving immix implementation, however it's more efficient in the standard GC as well to avoid pinning unnecessarily. Otherwise objects are pinned and not compacted. [link issue] Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
1 parent 3aee7b9 commit c7c8797

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

imemo.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ rb_alloc_tmp_buffer_with_count(volatile VALUE *store, size_t size, size_t cnt)
6868
* get rid of potential memory leak */
6969
tmpbuf = rb_imemo_tmpbuf_new();
7070
*store = (VALUE)tmpbuf;
71-
ptr = ruby_xmalloc(size);
71+
ptr = ruby_xcalloc(size, sizeof(char));
7272
tmpbuf->ptr = ptr;
7373
tmpbuf->cnt = cnt;
7474

@@ -408,14 +408,6 @@ rb_imemo_mark_and_move(VALUE obj, bool reference_updating)
408408
break;
409409
}
410410
case imemo_tmpbuf: {
411-
const rb_imemo_tmpbuf_t *m = (const rb_imemo_tmpbuf_t *)obj;
412-
413-
if (!reference_updating) {
414-
do {
415-
rb_gc_mark_locations(m->ptr, m->ptr + m->cnt);
416-
} while ((m = m->next) != NULL);
417-
}
418-
419411
break;
420412
}
421413
default:

0 commit comments

Comments
 (0)