mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Free cached mark stack chunks when freeing objspace
Cached mark stack chunks should also be freed when freeing objspace.
This commit is contained in:
parent
66b9ca8426
commit
2617532499
Notes:
git
2022-02-10 23:34:05 +09:00
1 changed files with 19 additions and 2 deletions
21
gc.c
21
gc.c
|
@ -1778,6 +1778,7 @@ rb_objspace_alloc(void)
|
|||
}
|
||||
|
||||
static void free_stack_chunks(mark_stack_t *);
|
||||
static void mark_stack_free_cache(mark_stack_t *);
|
||||
static void heap_page_free(rb_objspace_t *objspace, struct heap_page *page);
|
||||
|
||||
void
|
||||
|
@ -1817,7 +1818,10 @@ rb_objspace_free(rb_objspace_t *objspace)
|
|||
}
|
||||
st_free_table(objspace->id_to_obj_tbl);
|
||||
st_free_table(objspace->obj_to_id_tbl);
|
||||
|
||||
free_stack_chunks(&objspace->mark_stack);
|
||||
mark_stack_free_cache(&objspace->mark_stack);
|
||||
|
||||
free(objspace);
|
||||
}
|
||||
|
||||
|
@ -6092,9 +6096,8 @@ pop_mark_stack_chunk(mark_stack_t *stack)
|
|||
}
|
||||
|
||||
static void
|
||||
free_stack_chunks(mark_stack_t *stack)
|
||||
mark_stack_chunk_list_free(stack_chunk_t *chunk)
|
||||
{
|
||||
stack_chunk_t *chunk = stack->chunk;
|
||||
stack_chunk_t *next = NULL;
|
||||
|
||||
while (chunk != NULL) {
|
||||
|
@ -6104,6 +6107,20 @@ free_stack_chunks(mark_stack_t *stack)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_stack_chunks(mark_stack_t *stack)
|
||||
{
|
||||
mark_stack_chunk_list_free(stack->chunk);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_stack_free_cache(mark_stack_t *stack)
|
||||
{
|
||||
mark_stack_chunk_list_free(stack->cache);
|
||||
stack->cache_size = 0;
|
||||
stack->unused_cache_size = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
push_mark_stack(mark_stack_t *stack, VALUE data)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue