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

ruby-changes:23776

From: nari <ko1@a...>
Date: Mon, 28 May 2012 12:12:47 +0900 (JST)
Subject: [ruby-changes:23776] nari:r35827 (trunk): * gc.c (obj_free): doesn't free a method table if it doesn't

nari	2012-05-28 12:12:33 +0900 (Mon, 28 May 2012)

  New Revision: 35827

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

  Log:
    * gc.c (obj_free): doesn't free a method table if it doesn't
      exits. [ruby-dev:44436]
    * test/ruby/test_gc.rb (class TestGc): added the test case for
      this issue.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/test/ruby/test_gc.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35826)
+++ ChangeLog	(revision 35827)
@@ -1,3 +1,10 @@
+Mon May 28 12:03:04 2012  Narihiro Nakamura  <authornari@g...>
+
+	* gc.c (obj_free): doesn't free a method table if it doesn't
+	  exits. [ruby-dev:44436]
+	* test/ruby/test_gc.rb (class TestGc): added the test case for
+	  this issue.
+
 Sun May 27 23:37:48 2012  Koichi Sasada  <ko1@a...>
 
 	* benchmark/bm_vm1_lvar_init.rb: added.
Index: gc.c
===================================================================
--- gc.c	(revision 35826)
+++ gc.c	(revision 35827)
@@ -2501,7 +2501,9 @@
       case T_MODULE:
       case T_CLASS:
 	rb_clear_cache_by_class((VALUE)obj);
-	rb_free_m_table(RCLASS_M_TBL(obj));
+        if (RCLASS_M_TBL(obj)) {
+            rb_free_m_table(RCLASS_M_TBL(obj));
+        }
 	if (RCLASS_IV_TBL(obj)) {
 	    st_free_table(RCLASS_IV_TBL(obj));
 	}
Index: test/ruby/test_gc.rb
===================================================================
--- test/ruby/test_gc.rb	(revision 35826)
+++ test/ruby/test_gc.rb	(revision 35827)
@@ -78,6 +78,20 @@
     EOS
   end
 
+  def test_singleton_method_added
+    assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:44436]")
+      class BasicObject
+        def singleton_method_added(mid)
+          raise
+        end
+      end
+      b = proc {}
+      class << b; end
+      b.clone rescue nil
+      GC.start
+    EOS
+  end
+
   def test_gc_parameter
     env = {
       "RUBY_GC_MALLOC_LIMIT" => "60000000",

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

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