Sha256: f3e91e1c96d1a7689d195fcbd1fdf0c16c723552ffb0617a37020c051112d8c0

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require "heap-profiler"
require 'fileutils'
require 'date'

class SomeCustomStuff
end

$freed_objects = [+"i am free", +"i am free too"]

dir = ARGV.first
FileUtils.mkdir_p(dir)
FileUtils.rm_rf(Dir[File.join(dir, '*')])

if ARGV[1] == '--empty'
  HeapProfiler.report(dir) {}
else
  HeapProfiler.report(dir) do
    $retained_objects = [
      +"I am retained",
      +"I am retained",
      +"I am retained too",
      SomeCustomStuff.new,
      Date.today,
    ]
    "I am a very very long string " * 4
    [
      +"I am allocated",
      +"I am allocated too",
    ]
    $freed_objects = nil
    Struct.new("foo".to_sym, :bar)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
heap-profiler-0.5.0 bin/generate-report
heap-profiler-0.4.0 bin/generate-report
heap-profiler-0.3.0 bin/generate-report
heap-profiler-0.2.1 bin/generate-report
heap-profiler-0.2.0 bin/generate-report