Use of uninitialized value in exists at perftools.rb-0.5.6/bin/pprof line 2342 #28

ghazel opened this Issue Jul 16, 2011 · 7 comments

3 participants


After running the simple example:

require 'perftools'
PerfTools::CpuProfiler.start("/tmp/add_numbers_profile") do
  5_000_000.times{ 1+2+3+4+5 }

and trying to process the output:

pprof.rb --text /tmp/add_numbers_profile
Using local file /usr/local/ruby-enterprise-1.8.7-2010.01/bin/ruby.
Using local file /tmp/add_numbers_profile.
Use of uninitialized value in exists at /usr/local/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/perftools.rb-0.5.6/bin/pprof line 2342.
Total: 176 samples
     164  93.2%  93.2%      164  93.2% Integer#times

If it matters, I'm using google-perftools 1.7 not 1.6 as is linked to in the perftools.rb README.


Can you provide the lines in question from your patches pprof. This could be an upstream issue, or something introduced by my patches. Likely the latter since my perl skills are quite lacking.


Here is line 2342 of perftools.rb-0.5.6/bin/pprof

  if (exists $symbols->{$address}) {

I did not replace it with the pprof from google-perftools 1.7. Should I?


It depends how you build the 1.7 version of perftools.rb. If you updated extconf.rb it should have used the 1.7 version and applied the patches on top.

Aside from the warning, is pprof.rb working as expected. Looks like it produced the right output.


I gem installed perftools.rb before I ever downloaded and compiled google-perftools. I see now that perftools.rb comes with its own copy. Oops. The LD_PRELOAD I set in my output above was for the 1.7 .so I compiled. When I set LD_PRELOAD to the 1.6 .so included with perftools.rb I get this incorrect output:

Total: 179 samples
     169  94.4%  94.4%      169  94.4% 0x0000000001ffc2f9
      10   5.6% 100.0%       10   5.6% 0x0000000002d940c1
       0   0.0% 100.0%      169  94.4% 0x0000000002d940c0

If it's relevant, I'm on x86_64 and I have libunwind for my 1.7 build. Perhaps this output is due to perftool.rb using --enable-frame-pointers instead?


You should not be using LD_PRELOAD. Simply require 'perftools' and it will bring in the customized version of perftools.


Ok. I uninstalled the gem and my build of google-perftools 1.7 and removed my use of LD_PRELOAD. I installed perftools.rb again from scratch. The output appears to be correct, but I still get the Use of uninitialized value. I suppose I could just ignore it.


I can't find any circumstances of this error, but wrapped the statement in question with if (defined $address)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment