initialize allocated memory by VWA for assertions

When `RGENGC_CHECK_MODE` is enable, `obj_memsize_of` is called
in `newobj_init` and it expect the memory is zero-cleared.
This commit is contained in:
Koichi Sasada 2021-11-26 11:37:28 +09:00
parent 6586783508
commit 7f7c3a0a75

4
gc.c
View File

@ -2354,6 +2354,10 @@ ractor_cached_free_region(rb_objspace_t *objspace, rb_ractor_t *cr, size_t size_
VALUE obj = (VALUE)p;
cache->freelist = p->as.free.next;
asan_unpoison_object(obj, true);
#if RGENGC_CHECK_MODE
// zero clear
MEMZERO((char *)obj, char, size_pool_slot_size(size_pool_idx));
#endif
return obj;
}
else {