[前][次][番号順一覧][スレッド一覧]

ruby-changes:32240

From: nagachika <ko1@a...>
Date: Sat, 21 Dec 2013 16:38:29 +0900 (JST)
Subject: [ruby-changes:32240] nagachika:r44319 (ruby_2_0_0): merge revision(s) 43994: [Backport #9205]

nagachika	2013-12-21 16:38:21 +0900 (Sat, 21 Dec 2013)

  New Revision: 44319

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44319

  Log:
    merge revision(s) 43994: [Backport #9205]
    
    * gc.c (finalize_deferred): flush all deferred finalizers while other
      finalizers can get ready to run newly by lazy sweep.
      [ruby-core:58833] [Bug #9205]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/gc.c
    branches/ruby_2_0_0/test/ruby/test_gc.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 44318)
+++ ruby_2_0_0/ChangeLog	(revision 44319)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Dec 21 16:16:56 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* gc.c (finalize_deferred): flush all deferred finalizers while other
+	  finalizers can get ready to run newly by lazy sweep.
+	  [ruby-core:58833] [Bug #9205]
+
 Sat Dec 21 16:07:00 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby_atomic.h (ATOMIC_PTR_EXCHANGE): atomic exchange function for
Index: ruby_2_0_0/gc.c
===================================================================
--- ruby_2_0_0/gc.c	(revision 44318)
+++ ruby_2_0_0/gc.c	(revision 44319)
@@ -1443,10 +1443,9 @@ finalize_list(rb_objspace_t *objspace, R https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/gc.c#L1443
 static void
 finalize_deferred(rb_objspace_t *objspace)
 {
-    RVALUE *p = deferred_final_list;
-    deferred_final_list = 0;
+    RVALUE *p;
 
-    if (p) {
+    while ((p = ATOMIC_PTR_EXCHANGE(deferred_final_list, 0)) != 0) {
 	finalize_list(objspace, p);
     }
 }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 44318)
+++ ruby_2_0_0/version.h	(revision 44319)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-12-21"
-#define RUBY_PATCHLEVEL 364
+#define RUBY_PATCHLEVEL 365
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 12
Index: ruby_2_0_0/test/ruby/test_gc.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_gc.rb	(revision 44318)
+++ ruby_2_0_0/test/ruby/test_gc.rb	(revision 44319)
@@ -160,4 +160,18 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_gc.rb#L160
     assert base_length < GC.stat[:heap_length]
     eom
   end
+
+  def test_sweep_in_finalizer
+    bug9205 = '[ruby-core:58833] [Bug #9205]'
+    100.times do
+      assert_ruby_status([], <<-'end;', bug9205)
+        raise_proc = proc do |id|
+          GC.start
+        end
+        1000.times do
+          ObjectSpace.define_finalizer(Object.new, raise_proc)
+        end
+      end;
+    end
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r43994


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]