summaryrefslogtreecommitdiff
path: root/test/ruby/test_env.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-26 20:33:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-26 20:33:34 +0000
commit68bc5ba1b6695f80623441cb60436801add42757 (patch)
tree3d4590136e772f6888243551124fc2168a0d9f9b /test/ruby/test_env.rb
parentcfa7b2283b9b53ff8689d510d486f3488d9254d1 (diff)
hash.c: fix memory leak
* hash.c (env_shift): fix memory leak on Windows, free environment strings block always. [ruby-dev:48332] [Bug #9983] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_env.rb')
-rw-r--r--test/ruby/test_env.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 5eff01c5a2..820d9dcb3c 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -533,4 +533,13 @@ class TestEnv < Test::Unit::TestCase
ENV.select {ENV.clear}
end;
end
+
+ def test_memory_leak_shift
+ bug9983 = '[ruby-dev:48332] [Bug #9983]'
+ assert_no_memory_leak([], <<-'end;', "5_000.times {ENV.shift; ENV[k] = v}", bug9983)
+ ENV.clear
+ k = 'FOO'
+ v = (ENV[k] = 'bar'*5000 rescue 'bar'*1500)
+ end;
+ end
end