lib/heap_profiler/reporter.rb in heap-profiler-0.6.0 vs lib/heap_profiler/reporter.rb in heap-profiler-0.7.0

- old
+ new

@@ -33,22 +33,24 @@ class Reporter def initialize(dir_path) @dir_path = dir_path @enable_tracing = !allocation_tracing_enabled? @generation = nil + @partial = true end - def start + def start(partial: true) + @partial = partial FileUtils.mkdir_p(@dir_path) ObjectSpace.trace_object_allocations_start if @enable_tracing @allocated_heap = open_heap("allocated") @retained_heap = open_heap("retained") HeapProfiler.name_anonymous_modules! - 4.times { GC.start } + GC.start GC.disable @generation = GC.count end def stop @@ -58,14 +60,14 @@ # we can't use partial dump for allocated.heap, because we need old generations # as well to build the classes and strings indexes. dump_heap(@allocated_heap) GC.enable - 4.times { GC.start } - dump_heap(@retained_heap, partial: true) + GC.start + dump_heap(@retained_heap, partial: @partial) @allocated_heap.close @retained_heap.close - write_info("generation", @generation.to_s) + write_info("generation", @partial ? @generation.to_s : "0") end def run start begin