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

ruby-changes:38542

From: nagachika <ko1@a...>
Date: Sun, 24 May 2015 02:43:06 +0900 (JST)
Subject: [ruby-changes:38542] nagachika:r50623 (ruby_2_2): merge revision(s) 50187, 50202: [Backport #11051]

nagachika	2015-05-24 02:42:42 +0900 (Sun, 24 May 2015)

  New Revision: 50623

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

  Log:
    merge revision(s) 50187,50202: [Backport #11051]
    
    * ext/socket/raddrinfo.c (addrinfo_mload): fix memory leak of
      addrinfo.  [ruby-dev:48923] [Bug #11051]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/ext/socket/raddrinfo.c
    branches/ruby_2_2/test/socket/test_addrinfo.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 50622)
+++ ruby_2_2/ChangeLog	(revision 50623)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Sun May 24 02:21:47 2015  Masahiro Tomita  <tommy@t...>
+
+	* ext/socket/raddrinfo.c (addrinfo_mload): fix memory leak of
+	  addrinfo.  [ruby-dev:48923] [Bug #11051]
+
 Sun May 24 02:17:05 2015  Kenta Murata  <mrkn@c...>
 
 	* bigdecimal: conform to ruby's license.  [ruby-core:68466] [Bug #10952]
Index: ruby_2_2/ext/socket/raddrinfo.c
===================================================================
--- ruby_2_2/ext/socket/raddrinfo.c	(revision 50622)
+++ ruby_2_2/ext/socket/raddrinfo.c	(revision 50623)
@@ -1643,6 +1643,7 @@ addrinfo_mload(VALUE self, VALUE ary) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/raddrinfo.c#L1643
 
         len = res->ai->ai_addrlen;
         memcpy(&ss, res->ai->ai_addr, res->ai->ai_addrlen);
+        rb_freeaddrinfo(res);
         break;
       }
     }
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 50622)
+++ ruby_2_2/version.h	(revision 50623)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
 #define RUBY_RELEASE_DATE "2015-05-24"
-#define RUBY_PATCHLEVEL 119
+#define RUBY_PATCHLEVEL 120
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_2/test/socket/test_addrinfo.rb
===================================================================
--- ruby_2_2/test/socket/test_addrinfo.rb	(revision 50622)
+++ ruby_2_2/test/socket/test_addrinfo.rb	(revision 50623)
@@ -468,6 +468,17 @@ class TestSocketAddrinfo < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/socket/test_addrinfo.rb#L468
     assert_equal(ai1.canonname, ai2.canonname)
   end
 
+  def test_marshal_memory_leak
+    bug11051 = '[ruby-dev:48923] [Bug #11051]'
+    assert_no_memory_leak(%w[-rsocket], <<-PREP, <<-CODE, bug11051, rss: true, limit: 2.0)
+    d = Marshal.dump(Addrinfo.tcp("127.0.0.1", 80))
+    1000.times {Marshal.load(d)}
+    PREP
+    GC.start
+    20_000.times {Marshal.load(d)}
+    CODE
+  end
+
   if Socket.const_defined?("AF_INET6") && Socket::AF_INET6.is_a?(Integer)
 
     def test_addrinfo_new_inet6

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50187,50202


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

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