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

ruby-changes:38494

From: usa <ko1@a...>
Date: Thu, 21 May 2015 13:26:55 +0900 (JST)
Subject: [ruby-changes:38494] usa:r50575 (ruby_2_1): merge revision(s) 50187, 50202: [Backport #11051]

usa	2015-05-21 13:26:32 +0900 (Thu, 21 May 2015)

  New Revision: 50575

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

  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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/ext/socket/raddrinfo.c
    branches/ruby_2_1/test/socket/test_addrinfo.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 50574)
+++ ruby_2_1/ChangeLog	(revision 50575)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Thu May 21 13:23:44 2015  Masahiro Tomita  <tommy@t...>
+
+	* ext/socket/raddrinfo.c (addrinfo_mload): fix memory leak of
+	  addrinfo.  [ruby-dev:48923] [Bug #11051]
+
 Thu May 21 13:19:52 2015  Kenta Murata  <mrkn@c...>
 
 	* bigdecimal: conform to ruby's license.  [ruby-core:68466] [Bug #10952]
Index: ruby_2_1/ext/socket/raddrinfo.c
===================================================================
--- ruby_2_1/ext/socket/raddrinfo.c	(revision 50574)
+++ ruby_2_1/ext/socket/raddrinfo.c	(revision 50575)
@@ -1644,6 +1644,7 @@ addrinfo_mload(VALUE self, VALUE ary) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/socket/raddrinfo.c#L1644
 
         len = res->ai->ai_addrlen;
         memcpy(&ss, res->ai->ai_addr, res->ai->ai_addrlen);
+        rb_freeaddrinfo(res);
         break;
       }
     }
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 50574)
+++ ruby_2_1/version.h	(revision 50575)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.7"
 #define RUBY_RELEASE_DATE "2015-05-21"
-#define RUBY_PATCHLEVEL 348
+#define RUBY_PATCHLEVEL 349
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 5
Index: ruby_2_1/test/socket/test_addrinfo.rb
===================================================================
--- ruby_2_1/test/socket/test_addrinfo.rb	(revision 50574)
+++ ruby_2_1/test/socket/test_addrinfo.rb	(revision 50575)
@@ -4,6 +4,7 @@ rescue LoadError https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/socket/test_addrinfo.rb#L4
 end
 
 require "test/unit"
+require_relative "../ruby/envutil"
 
 class TestSocketAddrinfo < Test::Unit::TestCase
   HAS_UNIXSOCKET = defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM
@@ -468,6 +469,17 @@ class TestSocketAddrinfo < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/socket/test_addrinfo.rb#L469
     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)
+    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_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50187,50202


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

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