summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-09-25 16:55:54 +0900
committerKoichi Sasada <ko1@atdot.net>2019-09-25 17:01:54 +0900
commit3deeb3fd914bc5604e84e7a41ec2b5193a560479 (patch)
tree4506f86ac7876acbacbb4e9aca3fb6d939054c1e /array.c
parent112c9f1430ce495e76aef73221578adc9b240a3b (diff)
downloadruby-3deeb3fd914bc5604e84e7a41ec2b5193a560479.tar.gz
introduce `obj_ary_extracapa`.
Introduce a new debug counter `obj_ary_extracapa` which counts arrays which are `len < capa`.
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 2 insertions, 0 deletions
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);
}