Tatva-Artha

meaning of "it"

Archive for the ‘debug’ tag

Upgrading to ruby 1.9: rbx-require-relative requires Ruby version ~> 1.8.7

without comments

If you are upgrading from ruby 1.8 or Ruby Enterprise 1.8.7 to ruby 1.9.2, you may encounter this error.

Installing rbx-require-relative (0.0.5) Unfortunately, a fatal error has occurred.
Please report this error to the Bundler issue tracker at https://github.com/carlhuda/
bundler/issues so that we can fix it. Thanks!/Users/sjain/.rvm/rubies/ruby-1.9.2-p290/
lib/ruby/site_ruby/1.9.1/rubygems/ installer.rb:364:in `ensure_required_ruby_version_met':
rbx-require-relative requires Ruby version ~> 1.8.7. (Gem::InstallError)

This most likely happens because you are declaring a dependency on ruby-debug gem in your Gemfile.

group :development do
  gem 'ruby-debug'
end

With ruby 1.9, you need to update this with new gem name ruby-debug19.

group :development do
  gem 'ruby-debug19'
end

This will eliminate the dependency on rbx-require-relative and fix the issue.

Written by Sharad

August 21st, 2011 at 1:55 pm

Posted in All,Technology

Tagged with , , ,

Debugging Passenger Memory Issues

without comments

There was an interesting thread on ruby-passenger application server newsgroup recently: http://groups.google.com/group/phusion-passenger/browse_thread/thread/f48ad0eb018a2482

Here is my take away:

  # returns [class, count] tuples for all active records in the heap 
  def ar_space 
    GC.start 
    h = Hash.new(0) 
    ObjectSpace.each_object do |o| 
      next if o.__id__ == self.__id__ 
      next unless ActiveRecord::Base === o 
      h[o.class.to_s] += 1 
    end 
    return h.sort{|a,b| -(a[1]<=>b[1])} 
  end

Nifty little snippet to fetch number of active record objects on heap. I am guessing, incorporating this as Controller after_filter can help with cost of each request..

Written by Sharad

May 1st, 2011 at 1:05 pm

Posted in All

Tagged with , ,