0

Rubinius has a memory analysis tool which is started like this:

rbx -Xagent.start <script name>

se http://rubini.us/doc/en/tools/memory-analysis/

But how do I start a Ruby on Rails app for doing memory analysis?

rbx -Xagent.start rails server

does not do the trick!

For searching leaks in a Rails app what would you put for 'script name' ?

gem 'ruby-prof' is for MRI ruby RUBY_VERSION.between?('1.9.2', '2.0') only! So I assume this is the reason why rubinius has it's own tools/memory-analysis/ . I just do not understand how it is used in Rails.

Ernst
  • 235
  • 2
  • 12

1 Answers1

1

Start rails in terminal 1:

rbx -Xagent.start bin/rails s puma

Acess console in terminal 2:

rbx console
VM: rbx -Xagent.start bin/rails s puma
Connecting to VM on port 42051
Connected to localhost:42051, host type: i686-pc-linux-gnu
console> set system.memory.dump heap.dump1

Interpret dump

rbx -I <gem dir>/heap_dump/lib -S histo.rb heap.dump1 > dump1

heap dump interpretation tool

Code to read Rubinius HeapDump format

get fork which has gemspec

cd ~/rails/r
git clone https://github.com/kungfumike/heap_dump.git heap_dump
cd heap_dump
gem build heap_dump.gemspec
gem install heap_dump
Ernst
  • 235
  • 2
  • 12