From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <20170213004708.26143-1-e@80x24.org> (raw)
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
reply other threads:[~2017-02-13 0:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170213004708.26143-1-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).