diff --git a/gc/default/default.c b/gc/default/default.c index 35ca2ec107..42561543d1 100644 --- a/gc/default/default.c +++ b/gc/default/default.c @@ -7594,6 +7594,7 @@ enum gc_stat_heap_sym { gc_stat_heap_sym_slot_size, gc_stat_heap_sym_heap_live_slots, gc_stat_heap_sym_heap_free_slots, + gc_stat_heap_sym_heap_final_slots, gc_stat_heap_sym_heap_eden_pages, gc_stat_heap_sym_heap_eden_slots, gc_stat_heap_sym_total_allocated_pages, @@ -7614,6 +7615,7 @@ setup_gc_stat_heap_symbols(void) S(slot_size); S(heap_live_slots); S(heap_free_slots); + S(heap_final_slots); S(heap_eden_pages); S(heap_eden_slots); S(total_allocated_pages); @@ -7637,6 +7639,7 @@ stat_one_heap(rb_heap_t *heap, VALUE hash, VALUE key) SET(slot_size, heap->slot_size); SET(heap_live_slots, heap->total_allocated_objects - heap->total_freed_objects - heap->final_slots_count); SET(heap_free_slots, heap->total_slots - (heap->total_allocated_objects - heap->total_freed_objects)); + SET(heap_final_slots, heap->final_slots_count); SET(heap_eden_pages, heap->total_pages); SET(heap_eden_slots, heap->total_slots); SET(total_allocated_pages, heap->total_allocated_pages); diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 06bacf1b1a..6639013a54 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -233,6 +233,7 @@ class TestGc < Test::Unit::TestCase assert_equal (GC::INTERNAL_CONSTANTS[:BASE_SLOT_SIZE] + GC::INTERNAL_CONSTANTS[:RVALUE_OVERHEAD]) * (2**i), stat_heap[:slot_size] assert_operator stat_heap[:heap_live_slots], :<=, stat[:heap_live_slots] assert_operator stat_heap[:heap_free_slots], :<=, stat[:heap_free_slots] + assert_operator stat_heap[:heap_final_slots], :<=, stat[:heap_final_slots] assert_operator stat_heap[:heap_eden_pages], :<=, stat[:heap_eden_pages] assert_operator stat_heap[:heap_eden_slots], :>=, 0 assert_operator stat_heap[:total_allocated_pages], :>=, 0 @@ -290,6 +291,7 @@ class TestGc < Test::Unit::TestCase assert_equal stat[:heap_live_slots], stat_heap_sum[:heap_live_slots] assert_equal stat[:heap_free_slots], stat_heap_sum[:heap_free_slots] + assert_equal stat[:heap_final_slots], stat_heap_sum[:heap_final_slots] assert_equal stat[:heap_eden_pages], stat_heap_sum[:heap_eden_pages] assert_equal stat[:heap_available_slots], stat_heap_sum[:heap_eden_slots] assert_equal stat[:total_allocated_objects], stat_heap_sum[:total_allocated_objects]