From 816504c29c6fd304a7179882899a83db6c9cb2f1 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 8 Apr 2015 23:24:10 +0000 Subject: raddrinfo.c: fix memory leak * 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/trunk@50187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_addrinfo.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index 61b889ed26..1416553c9b 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: 1.1) + 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 -- cgit v1.2.1