Skip to content

Commit

Permalink
check ARY_SHARED_ROOT_P().
Browse files Browse the repository at this point in the history
ARY_SHARED_ROOT_P(ary) is true, ARY_HEAP_CAPA(ary) should not
be called.
  • Loading branch information
ko1 committed Sep 25, 2019
1 parent 3deeb3f commit 6d57816
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion array.c
Expand Up @@ -786,7 +786,11 @@ 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 (USE_DEBUG_COUNTER &&
!ARY_SHARED_ROOT_P(ary) &&
ARY_HEAP_CAPA(ary) > RARRAY_LEN(ary)) {
RB_DEBUG_COUNTER_INC(obj_ary_extracapa);
}

if (RARRAY_TRANSIENT_P(ary)) {
RB_DEBUG_COUNTER_INC(obj_ary_transient);
Expand Down

0 comments on commit 6d57816

Please sign in to comment.