Actions
Bug #20312
closedMemory leak with BigDecimal::EXCEPTION_OVERFLOW
    Bug #20312:
    Memory leak with BigDecimal::EXCEPTION_OVERFLOW
  
Description
The following causes a memory leak.
I left a commented line, both trigger an memory leak. I assume it's the same bug
require 'bigdecimal'
BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true)
10.times do |j|
  100000.times do |i|
    begin
      BigDecimal("1E11111111111111111111")
      #BigDecimal("1E1000000000000000000")**10 # Also leaks
    rescue
    end
  end
  GC.start
  puts `ps -o rss= -p #{$$}`.to_i
end
$ ruby local.rb
28652
34988
41060
47396
53732
59804
66140
72476
78548
84884
Happens in 3.2.3, 3.3.0, 3.3-head, ruby-head (of a few days ago).
        
           Updated by hsbt (Hiroshi SHIBATA) over 1 year ago
          Updated by hsbt (Hiroshi SHIBATA) over 1 year ago
          
          
        
        
      
      - Status changed from Open to Third Party's Issue
Hi, @MaxLap . Thank you for report this.
Can you file this to https://github.com/ruby/bigdecimal/? bigdecimal is already extracted from canonical ruby repository.
        
           Updated by MaxLap (Maxime Lapointe) over 1 year ago
          Updated by MaxLap (Maxime Lapointe) over 1 year ago
          
          
        
        
      
      Oh right! Sorry, done: https://github.com/ruby/bigdecimal/issues/290
Actions