Is it possible to use ruby-prof to profile memory/allocations in Ruby 2.1.1?

StackOverflow https://stackoverflow.com/questions/23435902

  •  14-07-2023
  •  | 
  •  

質問

From reading the doc https://github.com/ruby-prof/ruby-prof:

It seems that some patches were originally required for these features,

for allocations: http://rubyforge.org/tracker/index.php?func=detail&aid=11497&group_id=426&atid=1700

for memory use: http://rubyforge.org/tracker/index.php?func=detail&aid=17676&group_id=1814&atid=7062

The latter of which claims to have been applied.

This github issue seems to back that up: https://github.com/ruby-prof/ruby-prof/issues/86

But I have had absolutely no luck getting either of these modes to work in a 2.1.1 install, eg:

require 'ruby-prof'

RubyProf.measure_mode = RubyProf::MEMORY
RubyProf.start
  1000.times do
    s = "string"
  end
RubyProf::FlatPrinter.new(RubyProf.stop).print

Produces:

Thread ID: 4183000
Fiber ID: 8413080
Total: 0.000000
Sort by: self_time

 %self      total      self      wait     child     calls  name
   NaN      0.000     0.000     0.000     0.000        1   Integer#times 
   NaN      0.000     0.000     0.000     0.000        1   Global#[No method]

I even went so far as to try install ruby 1.9.3 to do this profiling, but rvm seems unable to find any of the old patches. Is there some way to get this working? or have these features been abandoned?

役に立ちましたか?

解決

According to a ruby-prof issue we need a patched version of ruby to use the memory profiler.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top