aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2022-05-06 09:37:21 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-05-09 08:45:24 -0400
commitb3f3cb0c383408ea2a6385e6a61f68f371e83497 (patch)
tree8e263ff6b635d79776560474f8fb8b17d1c96d0c
parent033e58cf2c6829e14fa38e0a364911361090aa83 (diff)
downloadruby-b3f3cb0c383408ea2a6385e6a61f68f371e83497.tar.gz
Call gc_sweep_finish_size_pool on size pools with no pages
Size pools with no pages won't be swept so gc_sweep_finish_size_pool will never be called on it, but gc_sweep_finish_size_pool must be called to grow the size pool.
-rw-r--r--gc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index b24a2f08a8..69b4178a99 100644
--- a/gc.c
+++ b/gc.c
@@ -1197,6 +1197,9 @@ static void gc_marks_continue(rb_objspace_t *objspace, rb_size_pool_t *size_pool
static void gc_sweep(rb_objspace_t *objspace);
static void gc_sweep_start(rb_objspace_t *objspace);
+#if USE_RVARGC
+static void gc_sweep_finish_size_pool(rb_objspace_t *objspace, rb_size_pool_t *size_pool);
+#endif
static void gc_sweep_finish(rb_objspace_t *objspace);
static int gc_sweep_step(rb_objspace_t *objspace, rb_size_pool_t *size_pool, rb_heap_t *heap);
static void gc_sweep_rest(rb_objspace_t *objspace);
@@ -5593,8 +5596,18 @@ gc_sweep_start(rb_objspace_t *objspace)
for (int i = 0; i < SIZE_POOL_COUNT; i++) {
rb_size_pool_t *size_pool = &size_pools[i];
+ rb_heap_t *heap = SIZE_POOL_EDEN_HEAP(size_pool);
gc_sweep_start_heap(objspace, SIZE_POOL_EDEN_HEAP(size_pool));
+
+#if USE_RVARGC
+ /* We should call gc_sweep_finish_size_pool for size pools with no pages. */
+ if (heap->sweeping_page == NULL) {
+ GC_ASSERT(heap->total_pages == 0);
+ GC_ASSERT(heap->total_slots == 0);
+ gc_sweep_finish_size_pool(objspace, size_pool);
+ }
+#endif
}
rb_ractor_t *r = NULL;