diff options
author | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-20 05:33:12 +0000 |
---|---|---|
committer | wyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-20 05:33:12 +0000 |
commit | 3765c7b6d4b25cc705409176e9925fe3e04ee0c6 (patch) | |
tree | ff956f7a739f0bc86267ffc1d75ae068e994744a | |
parent | 951a5e493a8f9ea8f08a510fcbe161512ab88a52 (diff) |
backport r24713 which adds a check for freelist exhaustion in gc_sweep; this prevents segfaults from certain tight loops. An example test case: Time.now while true
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@25871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | gc.c | 10 |
2 files changed, 13 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Thu Nov 19 2:44:00 2009 Kirk Haines <khaines@ruby-lang.org> + + * gc.c: backport r24713 which adds a check for freelist exhaustion in gc_sweep; this prevents segfaults from certain tight loops. An example test case: Time.now while true + Fri Aug 28 12:54:00 2009 Kirk Haines <khaines@ruby-lang.org> * Backport #1524 [ruby-core:23567]; lib/ostrct.rb (OpenStruct@new_ostruct_member): check if it's; also a little code cleanup to do a few things more efficiently. Tests adjusted accordingly. @@ -1183,7 +1183,15 @@ gc_sweep() /* clear finalization list */ if (final_list) { deferred_final_list = final_list; - rb_thread_pending = 1; + if (!freelist && !rb_thread_critical) { + rb_gc_finalize_deferred(); + } + else { + rb_thread_pending = 1; + } + if (!freelist) { + add_heap(); + } return; } free_unused_heaps(); |