summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-23 17:42:42 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-23 17:42:42 +0000
commit645b4e113054fbe2e2d7eb119116ae5b676e153d (patch)
tree5a4091528d50e50b81b530044b236219784fff9e /test
parentf0f734fda2e11e9f25fa91412bff70be640ed531 (diff)
merge revision(s) 50187,50202: [Backport #11051]
* ext/socket/raddrinfo.c (addrinfo_mload): fix memory leak of addrinfo. [ruby-dev:48923] [Bug #11051] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@50623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/socket/test_addrinfo.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index 61b889ed26..96e199170f 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -468,6 +468,17 @@ class TestSocketAddrinfo < Test::Unit::TestCase
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