From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS60729 192.36.27.0/24 X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_ZBI,RCVD_IN_XBL,RDNS_NONE,SPF_FAIL, SPF_HELO_FAIL,TO_EQ_FM_DOM_SPF_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (unknown [192.36.27.4]) by dcvr.yhbt.net (Postfix) with ESMTP id 4F09E1FC45 for ; Mon, 13 Feb 2017 00:47:09 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] array.c (ary_recycle_hash): use rb_gc_force_recycle Date: Mon, 13 Feb 2017 00:47:08 +0000 Message-Id: <20170213004708.26143-1-e@80x24.org> List-Id: Hidden objects (RBASIC_CLASS(hash) == 0) can never become visible to other threads or signal handlers via ObjectSpace.each_object or similar means. Thus it is safe to forcibly recycle the object slot for future use, here. --- array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/array.c b/array.c index f170a942ac..e970ca3787 100644 --- a/array.c +++ b/array.c @@ -4095,12 +4095,12 @@ ary_make_hash_by(VALUE ary) static inline void ary_recycle_hash(VALUE hash) { + assert(RBASIC_CLASS(hash) == 0); if (RHASH(hash)->ntbl) { st_table *tbl = RHASH(hash)->ntbl; - RHASH(hash)->ntbl = 0; st_free_table(tbl); } - RB_GC_GUARD(hash); + rb_gc_force_recycle(hash); } /* -- EW