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

ruby-changes:15519

From: mame <ko1@a...>
Date: Wed, 21 Apr 2010 00:16:04 +0900 (JST)
Subject: [ruby-changes:15519] Ruby:r27421 (trunk): * vm_method.c (rb_add_method_def): decrement alias count of

mame	2010-04-21 00:15:44 +0900 (Wed, 21 Apr 2010)

  New Revision: 27421

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

  Log:
    * vm_method.c (rb_add_method_def): decrement alias count of
      rb_method_definition_t to prevent memory leak.  see
      [ruby-dev:41021].

  Modified files:
    trunk/ChangeLog
    trunk/vm_method.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27420)
+++ ChangeLog	(revision 27421)
@@ -1,3 +1,9 @@
+Wed Apr 21 00:01:05 2010  Yusuke Endoh  <mame@t...>
+
+	* vm_method.c (rb_add_method_def): decrement alias count of
+	  rb_method_definition_t to prevent memory leak.  see
+	  [ruby-dev:41021].
+
 Tue Apr 20 21:33:06 2010  NAKAMURA Usaku  <usa@r...>
 
 	* ext/dl/win32/lib/win32/registry.rb (PredefinedKey#create): root key
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 27420)
+++ vm_method.c	(revision 27421)
@@ -215,6 +215,14 @@
 	 * another problem when the usage is changed.
 	 */
 	me = old_me;
+
+	if (me->def) {
+	    if (me->def->alias_count == 0)
+		xfree(me->def);
+	    else if (me->def->alias_count > 0)
+		me->def->alias_count--;
+	    me->def = 0;
+	}
     }
     else {
 	me = ALLOC(rb_method_entry_t);

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

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