1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

take VM lock when mutating the heap

This commit is contained in:
Aaron Patterson 2020-11-05 08:51:40 -08:00
parent 193edbde91
commit 68a3a2d90f
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6

8
gc.c
View file

@ -8524,6 +8524,8 @@ gc_sort_heap_by_empty_slots(rb_execution_context_t *ec, VALUE self)
gc_rest(objspace); gc_rest(objspace);
RB_VM_LOCK_ENTER();
{
list_for_each(&heap_eden->pages, page, page_node) { list_for_each(&heap_eden->pages, page, page_node) {
page_list[i++] = page; page_list[i++] = page;
GC_ASSERT(page != NULL); GC_ASSERT(page != NULL);
@ -8547,6 +8549,8 @@ gc_sort_heap_by_empty_slots(rb_execution_context_t *ec, VALUE self)
} }
free(page_list); free(page_list);
}
RB_VM_LOCK_LEAVE();
return Qnil; return Qnil;
} }
@ -8556,7 +8560,11 @@ gc_double_heap_size(rb_execution_context_t *ec, VALUE self)
{ {
rb_objspace_t *objspace = &rb_objspace; rb_objspace_t *objspace = &rb_objspace;
RB_VM_LOCK_ENTER();
{
heap_add_pages(objspace, heap_eden, heap_allocated_pages); heap_add_pages(objspace, heap_eden, heap_allocated_pages);
}
RB_VM_LOCK_LEAVE();
return Qnil; return Qnil;
} }