diff --git a/array.c b/array.c index 68f9321192..7b086f4ff9 100644 --- a/array.c +++ b/array.c @@ -786,6 +786,8 @@ void rb_ary_free(VALUE ary) { if (ARY_OWNS_HEAP_P(ary)) { + (void)RB_DEBUG_COUNTER_INC_IF(obj_ary_extracapa, ARY_HEAP_CAPA(ary) > RARRAY_LEN(ary)); + if (RARRAY_TRANSIENT_P(ary)) { RB_DEBUG_COUNTER_INC(obj_ary_transient); } diff --git a/debug_counter.h b/debug_counter.h index 2add2acc25..cb2222a869 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -206,6 +206,7 @@ RB_DEBUG_COUNTER(obj_str_fstr) RB_DEBUG_COUNTER(obj_ary_embed) RB_DEBUG_COUNTER(obj_ary_transient) RB_DEBUG_COUNTER(obj_ary_ptr) +RB_DEBUG_COUNTER(obj_ary_extracapa) /* ary_shared_create: shared ary by Array#dup and so on. ary_shared: finished in shard.