Debugging Passenger Memory Issues
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..
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.





