From 66abf4ad68609d70d7a1ebe14c519c150b5957ef Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 8 May 2010 02:07:43 +0000 Subject: * ext/bigdecimal/bigdecimal.c (VpAlloc): ensure buf does not get collected. based on a patch masaya tarui at [ruby-dev:41213]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/bigdecimal/test_bigdecimal.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/bigdecimal/test_bigdecimal.rb') diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index b266233b20..b8d933eb1c 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -698,4 +698,15 @@ class TestBigDecimal < Test::Unit::TestCase assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, BigDecimal.new("1E-1" + "0" * 10000).sign) assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, BigDecimal.new("-1E-1" + "0" * 10000).sign) end + + def test_gc + bug3258 = '[ruby-dev:41213]' + stress, GC.stress = GC.stress, true + 1000.times do |i| + b = BigDecimal.new("1"+"0"*i).to_s + assert_equal([1, "1", 10, i+1], b.split, bug3258) + end + ensure + GC.stress = stress + end end -- cgit v1.2.3