introduce `obj_ary_extracapa`.

Introduce a new debug counter `obj_ary_extracapa` which counts
arrays which are `len < capa`.
This commit is contained in:
Koichi Sasada 2019-09-25 16:55:54 +09:00
Родитель 112c9f1430
Коммит 3deeb3fd91
2 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -786,6 +786,8 @@ void
rb_ary_free(VALUE ary) rb_ary_free(VALUE ary)
{ {
if (ARY_OWNS_HEAP_P(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)) { if (RARRAY_TRANSIENT_P(ary)) {
RB_DEBUG_COUNTER_INC(obj_ary_transient); RB_DEBUG_COUNTER_INC(obj_ary_transient);
} }

Просмотреть файл

@ -206,6 +206,7 @@ RB_DEBUG_COUNTER(obj_str_fstr)
RB_DEBUG_COUNTER(obj_ary_embed) RB_DEBUG_COUNTER(obj_ary_embed)
RB_DEBUG_COUNTER(obj_ary_transient) RB_DEBUG_COUNTER(obj_ary_transient)
RB_DEBUG_COUNTER(obj_ary_ptr) 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_create: shared ary by Array#dup and so on.
ary_shared: finished in shard. ary_shared: finished in shard.