diff --git a/gc.c b/gc.c index a128e9a93e..4f5d50d67a 100644 --- a/gc.c +++ b/gc.c @@ -11005,6 +11005,7 @@ enum gc_stat_heap_sym { gc_stat_heap_sym_heap_tomb_slots, gc_stat_heap_sym_total_allocated_pages, gc_stat_heap_sym_total_freed_pages, + gc_stat_heap_sym_force_major_gc_count, gc_stat_heap_sym_last }; @@ -11023,6 +11024,7 @@ setup_gc_stat_heap_symbols(void) S(heap_tomb_slots); S(total_allocated_pages); S(total_freed_pages); + S(force_major_gc_count); #undef S } } @@ -11065,6 +11067,7 @@ gc_stat_heap_internal(int size_pool_idx, VALUE hash_or_sym) SET(heap_tomb_slots, SIZE_POOL_TOMB_HEAP(size_pool)->total_slots); SET(total_allocated_pages, size_pool->total_allocated_pages); SET(total_freed_pages, size_pool->total_freed_pages); + SET(force_major_gc_count, size_pool->force_major_gc_count); #undef SET if (!NIL_P(key)) { /* matched key should return above */ diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index b081e9fa78..a5d7f4dbaa 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -160,6 +160,7 @@ class TestGc < Test::Unit::TestCase assert_operator stat_heap[:heap_tomb_slots], :>=, 0 assert_operator stat_heap[:total_allocated_pages], :>=, 0 assert_operator stat_heap[:total_freed_pages], :>=, 0 + assert_operator stat_heap[:force_major_gc_count], :>=, 0 end GC.stat_heap(0, stat_heap)