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:
parent
193edbde91
commit
68a3a2d90f
1 changed files with 30 additions and 22 deletions
8
gc.c
8
gc.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue