garbage collection - Ruby GC::Profiler no output -


i'm running ruby script , trying see gc stats on it, output empty string. here contents of script:

class numberpool    ...    attr_accessor :sets    def initialize     @sets = []   end    def allocate     allocated_number = random.rand(min_bound..max_bound)     sets.each |set|       next unless set.range.include?(allocated_number)       return set.range.delete(allocated_number)     end     factor = allocated_number / batch_size     min = factor * batch_size     max = min + batch_size     sub = subpool.new(min, max)     sub.range.delete(allocated_number)     sets.push(sub)     allocated_number   end    ...  def run_test   gc::profiler.enable    = numberpool.new   p a.allocate    gc::profiler.report end  puts run_test 

when run this, output is:

$ ruby number_pool.rb 1855532 

i expected see gc report in standard out.

this guess, maybe gc hasn't triggered (no need collect garbage yet because plenty of free memory).

see happens if force gc adding gc.start (modify code so):

   p a.allocate    gc.start    gc::profiler.report 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -