Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Created April 23, 2015 13:18
Show Gist options
  • Save toolmantim/d9a18fc7e853f93cb052 to your computer and use it in GitHub Desktop.
Save toolmantim/d9a18fc7e853f93cb052 to your computer and use it in GitHub Desktop.
Rails/Sprockets related sections of the MemoryProfiler dump
$ ruby -rmemory_profiler -I. -e 'MemoryProfiler.report { require "config/environment" }.pretty_print'
Total allocated 2057572
Total retained 390073
allocated memory by gem
-----------------------------------
activesupport-4.2.1 x 60094221
sprockets-3.0.1 x 56626099
2.2.0/lib x 28225732
rubygems x 13918784
json-1.8.2 x 9353860
mime-types-2.4.3 x 7098487
...
allocated memory by file
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb x 54840366
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb x 53088202
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb x 16261239
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb x 8943020
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb x 6951252
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/specification.rb x 5609162
...
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets.rb x 448318
...
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/cache/file_store.rb x 381179
...
allocated memory by location
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274 x 48201062
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:119 x 40837302
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb:370 x 16130796
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:121 x 13931878
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb:155 x 8830282
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268 x 4648766
...
allocated objects by gem
-----------------------------------
activesupport-4.2.1 x 566345
sprockets-3.0.1 x 447215
2.2.0/lib x 221008
rubygems x 136332
mime-types-2.4.3 x 66063
parser-2.2.2.1 x 65081
...
allocated objects by file
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb x 505988
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb x 430660
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb x 81577
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb x 65340
/app/vendor/bundle/ruby/2.2.0/gems/parser-2.2.2.1/lib/parser/ruby22.rb x 64436
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych/visitors/to_ruby.rb x 64207
...
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets.rb x 4317
...
allocated objects by location
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274 x 458386
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:119 x 298844
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:121 x 131100
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb:370 x 80241
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb:155 x 55543
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268 x 46089
...
retained memory by gem
-----------------------------------
sprockets-3.0.1 x 14024689
2.2.0/lib x 7370079
activesupport-4.2.1 x 5285833
mime-types-2.4.3 x 3216794
json-1.8.2 x 3141886
rubygems x 1008626
...
sprockets-rails-2.2.4 x 28261
...
retained memory by file
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb x 13941246
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb x 4403673
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb x 4051787
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb x 3134084
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb x 3072513
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych/visitors/to_ruby.rb x 2481087
...
retained memory by location
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:121 x 13931878
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb:370 x 4044977
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274 x 3671422
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb:155 x 3131787
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:345 x 2480960
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb:596 x 975858
...
retained objects by gem
-----------------------------------
sprockets-3.0.1 x 132076
2.2.0/lib x 85720
activesupport-4.2.1 x 57352
json-1.8.2 x 21180
mime-types-2.4.3 x 21063
rubygems x 10237
...
sprockets-rails-2.2.4 x 325
...
retained objects by file
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb x 131212
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb x 47976
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb x 45979
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych/visitors/to_ruby.rb x 31013
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb x 21093
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb x 20370
...
retained objects by location
-----------------------------------
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:121 x 131100
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych.rb:370 x 45911
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274 x 39423
~/.rbenv/versions/2.2.0/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:345 x 31012
/app/vendor/bundle/ruby/2.2.0/gems/json-1.8.2/lib/json/common.rb:155 x 21068
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268 x 8488
...
Allocated String Report
-----------------------------------
"" x 85789
/app/vendor/bundle/ruby/2.2.0/gems/sprockets-3.0.1/lib/sprockets/mime.rb:119 x 36285
/app/vendor/bundle/ruby/2.2.0/gems/parser-2.2.2.1/lib/parser/ruby22.rb:882 x 12012
/app/vendor/bundle/ruby/2.2.0/gems/parser-2.2.2.1/lib/parser/ruby22.rb:1805 x 12012
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb:621 x 3738
/app/vendor/bundle/ruby/2.2.0/gems/mime-types-2.4.3/lib/mime/type.rb:638 x 3738
/app/vendor/bundle/ruby/2.2.0/gems/parser-2.2.2.1/lib/parser/ruby22.rb:2203 x 2088
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment