class Heapy::CLI

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/heapy.rb, line 8
def self.exit_on_failure?
  true
end

Public Instance Methods

diff(before, after, retained = nil) click to toggle source
# File lib/heapy.rb, line 66
def diff(before, after, retained = nil)
  Diff.new(before: before, after: after, retained: retained, output_diff: options[:output_diff] || nil).call
end
read(file_name, generation = nil) click to toggle source
# File lib/heapy.rb, line 42
def read(file_name, generation = nil)
  if generation
    Analyzer.new(file_name).drill_down(generation, options[:lines] || 50)
  else
    Analyzer.new(file_name).analyze
  end
end
version() click to toggle source
# File lib/heapy.rb, line 72
def version
  puts Heapy::VERSION
end
wat() click to toggle source
# File lib/heapy.rb, line 77
    def wat
      puts <<-HELP

To get a heap dump do this:

    require 'objspace'
    ObjectSpace.trace_object_allocations_start

    # Your code here

    p ObjectSpace.dump_all

    # => #<File:/path/to/output/heap/dump/here.json>

This will print the file name of your heap dump.

If you prefer you can manually pass in an IO object to `ObjectSpace.dump_all`

    io = File.open("/tmp/my_dump.json", "w+")
    ObjectSpace.dump_all(output: io);
    io.close

HELP
    end