From c5e08b764eb342538884b383f0e6428b6faf214b Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 29 Oct 2013 11:16:54 +0000 Subject: * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index e501f78675..ef869c6c28 100644 --- a/thread.c +++ b/thread.c @@ -3957,6 +3957,7 @@ thgroup_memsize(const void *ptr) static const rb_data_type_t thgroup_data_type = { "thgroup", {NULL, RUBY_TYPED_DEFAULT_FREE, thgroup_memsize,}, + NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY }; /* @@ -4195,6 +4196,7 @@ mutex_memsize(const void *ptr) static const rb_data_type_t mutex_data_type = { "mutex", {mutex_mark, mutex_free, mutex_memsize,}, + NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY }; VALUE @@ -4644,6 +4646,7 @@ thread_shield_mark(void *ptr) static const rb_data_type_t thread_shield_data_type = { "thread_shield", {thread_shield_mark, 0, 0,}, + NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY }; static VALUE -- cgit v1.2.3