Sha256: 70593009d62912a3854ebe115a0da035b0263894afe47165b1cd0763c65e4a17

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

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

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,
    ]
    "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

1 entries across 1 versions & 1 rubygems

Version Path
heap-profiler-0.1.0 bin/generate-report