内容简介:参考:和 另外一种更牛的方式:安装:
参考: https://github.com/schneems/derailed_benchmarks
和 另外一种更牛的方式: https://collectiveidea.com/blog/archives/2015/02/19/optimizing-rails-for-memory-usage-part-1-before-you-optimize
安装:
# 检测内存泄漏 gem 'derailed_benchmarks', group: :development gem 'stackprof', group: :development
然后 $ bundle 就可以
运行:
1. 查看各种Gem占用的内存
root@test-server:/opt/app/test.wondercv.com/current# bundle exec derailed bundle:mem TOP: 117.3281 MiB rails/all: 21.5273 MiB rails: 9.9023 MiB (Also required by: active_record/railtie, active_model/railtie, and 12 others) active_support/railtie: 4.5859 MiB active_support/i18n_railtie: 4.5859 MiB active_support/file_update_checker: 2.6797 MiB (Also required by: rails/application/configuration) active_support/core_ext/time/calculations: 2.6797 MiB (Also required by: active_support/core_ext/time, active_support/core_ext/numeric/time) active_support/core_ext/time/conversions: 2.0195 MiB (Also required by: active_support/core_ext/time, active_support/core_ext/date_time/conversions) active_support/values/time_zone: 1.7695 MiB (Also required by: active_support/time_with_zone, active_support/core_ext/date_time/conversions) tzinfo: 1.7695 MiB tzinfo/timezone: 0.5156 MiB awesome_rails_console: 6.5273 MiB awesome_rails_console/railtie: 6.5078 MiB pry-rails: 6.0273 MiB pry: 6.0273 MiB pry/cli: 2.8281 MiB /root/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/pry-byebug-3.6.0/lib/pry-byebug/cli.rb: 2.8281 MiB pry-byebug/pry_ext: 2.4492 MiB byebug/processors/pry_processor: 2.4492 MiB byebug/core: 2.4492 MiB byebug/commands: 1.8711 MiB byebug/commands/irb: 0.7461 MiB (Also required by: /root/.rbenv/versions/2.3.8/lib/ruby/gems/2.3.0/gems/byebug-10.0.2/lib/byebug/settings/autoirb.rb) irb: 0.7461 MiB irb/ruby-lex: 0.4922 MiB pry/commands: 1.6602 MiB awesome_print: 0.4805 MiB uglifier: 5.7539 MiB execjs: 4.543 MiB (Also required by: coffee_script) execjs/runtimes: 0.6445 MiB uglifier/version: 0.9922 MiB amoeba: 4.4961 MiB active_record/base: 3.9805 MiB active_record/validations: 0.7734 MiB active_model/validations: 0.5156 MiB active_record/querying: 0.3711 MiB pg: 3.9648 MiB pg_ext: 3.707 MiB
以上所述就是小编给大家介绍的《rails - 为rails消耗的内存做检测 memory leak 检测工具 derailed_benchmarks》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 【Android】性能优化:电量消耗统计
- 优化 DeFi 合约利息计算 gas 消耗
- MySQL 导致 CPU 消耗过大,如何优化
- 为什么系统调用会消耗较多资源
- iOS 电量消耗改善:一招套路及相关姿势
- HBase 写吞吐场景资源消耗量化分析及优化
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。