[#75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function — shyouhei@...
Issue #12416 has been reported by Shyouhei Urabe.
3 messages
2016/05/23
[#75763] [Ruby trunk Feature#12435] Using connect_nonblock to open TCP connections in Net::HTTP#connect — mohamed.m.m.hafez@...
Issue #12435 has been reported by Mohamed Hafez.
3 messages
2016/05/28
[#75774] Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock — Mohamed Hafez <mohamed.m.m.hafez@...>
Hi all, every now and then in my production server, I'm
4 messages
2016/05/30
[#75775] Re: Errno::EAGAIN thrown by OpenSSL::SSL::SSLSocket#connect_nonblock
— Mohamed Hafez <mohamed.m.m.hafez@...>
2016/05/30
Or does MRI's OpenSSL::SSL::SSLSocket#connect_nonblock just return
[#75782] Important: Somewhat backwards-incompatible change (Fwd: [ruby-cvs:62388] duerst:r55225 (trunk): * string.c: Activate full Unicode case mapping for UTF-8) — Martin J. Dürst <duerst@...>
With the change below, I have activated full Unicode case mapping for
4 messages
2016/05/31
[ruby-core:75687] [Ruby trunk Bug#12416] struct rb_id_table lacks mark function
From:
shyouhei@...
Date:
2016-05-23 07:20:33 UTC
List:
ruby-core #75687
Issue #12416 has been reported by Shyouhei Urabe.
----------------------------------------
Bug #12416: struct rb_id_table lacks mark function
https://bugs.ruby-lang.org/issues/12416
* Author: Shyouhei Urabe
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.4.0dev (2016-05-23) [x86_64-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```
From 368b63af3b9d4205048f19058453cddda0cf242c Mon Sep 17 00:00:00 2001
From: "Urabe, Shyouhei" <shyouhei@ruby-lang.org>
Date: Mon, 23 May 2016 16:03:04 +0900
Subject: [PATCH 1/1] [Bug] rb_id_table must come with mark function.
The struct rb_id_table can hold arbitrary VALUE values. Now that this
struct is reachable form Ruby's object space, it must understand what GC
requests to it.
* id_table.c (rb_id_table_mark): new function to avoid GC leak for
id tables. This function applies against all implementations.
* id_table.h (rb_id_table_mark): ditto.
Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org>
---
id_table.c | 17 +++++++++++++++++
id_table.h | 1 +
iseq.c | 1 +
3 files changed, 19 insertions(+)
diff --git a/id_table.c b/id_table.c
index b8111aa..0649d0b 100644
--- a/id_table.c
+++ b/id_table.c
@@ -1586,3 +1586,20 @@ show_impl(void)
fprintf(stderr, "impl: %d\n", ID_TABLE_IMPL);
}
#endif
+
+/* impl-agnostic functions */
+
+static enum rb_id_table_iterator_result
+rb_id_table_mark_generic_i(VALUE v, void *ign)
+{
+ rb_gc_mark(v);
+ return ID_TABLE_CONTINUE;
+}
+
+void
+rb_id_table_mark(struct rb_id_table *tbl)
+{
+ if (tbl) {
+ rb_id_table_foreach_values(tbl, rb_id_table_mark_generic_i, NULL);
+ }
+}
diff --git a/id_table.h b/id_table.h
index 4b4eb6f..ffdccd6 100644
--- a/id_table.h
+++ b/id_table.h
@@ -12,6 +12,7 @@ enum rb_id_table_iterator_result {
};
struct rb_id_table *rb_id_table_create(size_t size);
+void rb_id_table_mark(struct rb_id_table *tbl);
void rb_id_table_free(struct rb_id_table *tbl);
void rb_id_table_clear(struct rb_id_table *tbl);
diff --git a/iseq.c b/iseq.c
index 28d35eb..6d68ea4 100644
--- a/iseq.c
+++ b/iseq.c
@@ -128,6 +128,7 @@ rb_iseq_mark(const rb_iseq_t *iseq)
RUBY_MARK_UNLESS_NULL(compile_data->mark_ary);
RUBY_MARK_UNLESS_NULL(compile_data->err_info);
RUBY_MARK_UNLESS_NULL(compile_data->catch_table_ary);
+ rb_id_table_mark(compile_data->ivar_cache_table);
}
RUBY_MARK_LEAVE("iseq");
--
2.8.2
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>