Skip to content

Commit

Permalink
backport r24713 which adds a check for freelist exhaustion in gc_swee…
Browse files Browse the repository at this point in the history
…p; 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
  • Loading branch information
wyhaines committed Nov 20, 2009
1 parent 951a5e4 commit 3765c7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 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.
Expand Down
10 changes: 9 additions & 1 deletion gc.c
Expand Up @@ -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();
Expand Down

0 comments on commit 3765c7b

Please sign in to comment.