[前][次][番号順一覧][スレッド一覧]

ruby-changes:57897

From: Koichi <ko1@a...>
Date: Wed, 25 Sep 2019 17:14:11 +0900 (JST)
Subject: [ruby-changes:57897] 6d578164f5 (master): check `ARY_SHARED_ROOT_P()`.

https://git.ruby-lang.org/ruby.git/commit/?id=6d578164f5

From 6d578164f5da815fb71d23ad186e841359384f25 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Wed, 25 Sep 2019 17:12:55 +0900
Subject: check `ARY_SHARED_ROOT_P()`.

ARY_SHARED_ROOT_P(ary) is true, ARY_HEAP_CAPA(ary) should not
be called.

diff --git a/array.c b/array.c
index 7b086f4..825d9f7 100644
--- a/array.c
+++ b/array.c
@@ -786,7 +786,11 @@ void https://github.com/ruby/ruby/blob/trunk/array.c#L786
 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);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]