Upgrade to Pro — share decks privately, control downloads, hide ads and more …

追踪 Rails 应用中的内存泄露

Yunzheng
September 23, 2016

追踪 Rails 应用中的内存泄露

RubyConf China 2016. presented by 42thcoder

Yunzheng

September 23, 2016

Transcript

88 slides
  1. ERP

  2. resident set size, the non- swapped physical memory that a

    task has used. RSS VSZ virtual memory size of the process in KiB. Device mappings are currently excluded; this is subject to change.
  3. APM

  4. 接口 X 会生成大量 Timeout 对象, 占用内存过多 总结 profile 要比 monitor

    目的性更强 内存泄露确实存在, 内存随时间不断上涨
  5. #!/usr/bin/env ruby
 # encoding: utf-8
 
 require 'memory_profiler'
 
 gem

    'redis', ENV['RVERSION']
 require 'redis'
 
 puts Process.pid
 puts Redis::VERSION
 
 MemoryProfiler.report {
 r = Redis.new
 i=0
 100.times do
 r.set "key#{i}", "value#{i}"
 end
 }.pretty_print
  6. Rbkit & Rbkit Client https://github.com/code-mancers/rbkit A new profiler for Ruby.

    With a GUI http://rbkit.codemancers.com 2.3.x 下无法使用

Other Decks in Programming