Topic: GC Logging

Is there any way I can get a log message every time ruby does garbage collection?

Re: GC Logging

Think this is what you need to do, or at least close:

GC.instance_eval do
  alias start_old start
  def start
    puts "#{Time.now}: in GC#start"
    start_old
  end
end

Re: GC Logging

No luck.

I put this in environment.rb, and I can get it to log a message just under the do, and if I call GC.start, it logs it, but there is never a log of ruby doing it in it's own time.

Any other ideas?

Thanks for your help.