diff --git a/gc.c b/gc.c index 086b6ad96e..6e32997b8e 100644 --- a/gc.c +++ b/gc.c @@ -8118,6 +8118,7 @@ rb_alloc_tmp_buffer_with_count(volatile VALUE *store, size_t size, size_t cnt) void *ptr; s = rb_imemo_new(imemo_alloc, 0, 0, 0, 0); + rb_gc_writebarrier_unprotect(s); ptr = ruby_xmalloc0(size); a = (rb_imemo_alloc_t*)s; a->ptr = (VALUE*)ptr; diff --git a/parse.y b/parse.y index 60898e6422..7a5b680da0 100644 --- a/parse.y +++ b/parse.y @@ -11538,6 +11538,7 @@ rb_parser_malloc(struct parser_params *parser, size_t size) size_t cnt = HEAPCNT(1, size); rb_imemo_alloc_t *n = NEWHEAP(); void *ptr = xmalloc(size); + rb_gc_writebarrier_unprotect((VALUE)n); return ADD2HEAP(n, cnt, ptr); } @@ -11548,6 +11549,7 @@ rb_parser_calloc(struct parser_params *parser, size_t nelem, size_t size) size_t cnt = HEAPCNT(nelem, size); rb_imemo_alloc_t *n = NEWHEAP(); void *ptr = xcalloc(nelem, size); + rb_gc_writebarrier_unprotect((VALUE)n); return ADD2HEAP(n, cnt, ptr); } @@ -11569,6 +11571,7 @@ rb_parser_realloc(struct parser_params *parser, void *ptr, size_t size) } n = NEWHEAP(); ptr = xrealloc(ptr, size); + rb_gc_writebarrier_unprotect((VALUE)n); return ADD2HEAP(n, cnt, ptr); }