summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-20 05:33:12 +0000
committerwyhaines <wyhaines@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-20 05:33:12 +0000
commit3765c7b6d4b25cc705409176e9925fe3e04ee0c6 (patch)
treeff956f7a739f0bc86267ffc1d75ae068e994744a
parent951a5e493a8f9ea8f08a510fcbe161512ab88a52 (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--ChangeLog4
-rw-r--r--gc.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bd6f0ca6e6..62638f9793 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/gc.c b/gc.c
index 66ce2634cd..3372b7c279 100644
--- a/gc.c
+++ b/gc.c
@@ -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();