New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial memory footprint is high #1773

Closed
guy-silva opened this Issue Nov 16, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@guy-silva

guy-silva commented Nov 16, 2015

Evaluating the memory footprint of the application I work on I've found out(using https://github.com/schneems/derailed_benchmarks) that carrierwave is surprisingly the biggest memory eater of all (even more than rails).
by having a Gemfile

gem "carrierwave"
gem "derailed"

and running

$ bundle exec derailed bundle:objects > report.txt

you get something like

Measuring objects created by gems in groups [:default, "production"]
Total allocated: 23753417 bytes (190080 objects)
Total retained:  10007743 bytes (69316 objects)

allocated memory by gem
-----------------------------------
   9631125  mime-types-2.6.2
   6574070  json-1.8.3
   3446513  activesupport-4.2.4
   2317923  carrierwave-0.10.0
   1323915  tzinfo-1.2.2
    189375  i18n-0.7.0
    149734  thread_safe-0.3.5
     57220  bundler-1.10.6
     36829  2.2.2/lib
     26553  2.2.0
        80  derailed-0.1.0
        80  derailed_benchmarks-1.1.3

allocated memory by file
-----------------------------------
   7823703  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mime-types-2.6.2/lib/mime/type.rb
   6355106  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/json-1.8.3/lib/json/common.rb
   1271269  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/tzinfo-1.2.2/lib/tzinfo.rb
    671886  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mime-types-2.6.2/lib/mime/types/cache.rb
    586156  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave.rb
    552889  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader.rb
    509931  /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mime-types-2.6.2/lib/mime/types.rb
...

(the whole file can be seen at https://gist.github.com/guy-silva/36ea146d7fd0eaf3c735 )

I can see it is due mime-types and I saw that carrierwave tried to make usage of the new Columnar type according to #1652

By chance is there something else we can do to decrease this?

@thomasfedb

This comment has been minimized.

Show comment
Hide comment
@thomasfedb

thomasfedb Nov 18, 2015

Contributor

@guy-silva If you're able to provide any further analysis regarding the nature of excessive allocation by Carrierwave and/or suggestions on how to improve the gem's memory footprint then this might be able to be looked in to.

Contributor

thomasfedb commented Nov 18, 2015

@guy-silva If you're able to provide any further analysis regarding the nature of excessive allocation by Carrierwave and/or suggestions on how to improve the gem's memory footprint then this might be able to be looked in to.

@thomasfedb thomasfedb closed this Dec 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment