Skip to content

Memory Use exploded in 2.6 #812

@schneems

Description

@schneems

Rails 4.2 is moving to Mail 2.6.1 and i'm seeing a huge increase in memory usage in my running application. After some digging, it looks like the culprit was the Mail version bump.

To demonstrate the issue, here's a script to reproduce without rails:

Build Gemfiles

$ mkdir 2.6.1
$ cat <<  EOF > 2.6.1/Gemfile
  source 'https://rubygems.org'
  gem 'mail', '2.6.1'
  gem 'get_process_mem'
EOF

$ mkdir 2.5.4
$ cat <<  EOF > 2.5.4/Gemfile
  source 'https://rubygems.org'
  gem 'mail', '2.5.4'
  gem 'get_process_mem'
EOF

Install

$ env BUNDLE_GEMFILE=2.6.1/gemfile bundle install
$ env BUNDLE_GEMFILE=2.5.4/gemfile bundle install

Test script

$ cat <<  EOF > script.rb
  require 'get_process_mem'
  mem = GetProcessMem.new
  before = mem.mb
  require 'mail'
  after = mem.mb
  puts after - before
EOF 

Results

$ env BUNDLE_GEMFILE=2.6.1/gemfile bundle exec ruby script.rb
# => 41.44140625 # mb
$ env BUNDLE_GEMFILE=2.5.4/gemfile bundle exec ruby script.rb
# => 11.41015625 # mb

EWAT

Mail 2.6.1 takes up almost 4 times more memory at Require time 0_o. Initial guess is that this has to do with the switch from treetop to ragel via @bpot

cc/@matthewd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions