heap-profiler 0.6.0 → 0.8.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d471a3cfa86394c637238b8d27fb487b764862a45ef016e6de9570e9b90811ab
4
- data.tar.gz: 05d056160722162d9e6a2866e69baba73a8eb9bc4237e0d1fc597573c15b2380
3
+ metadata.gz: 92efd93f10852975c56294f5cdcfce51bddfcaf5b91631a7f4eac615a4736af1
4
+ data.tar.gz: c2ce4ec3f6901a179981b7b4eed2d384303cc7717450c22d839d96c06cce47eb
5
5
  SHA512:
6
- metadata.gz: a8d5cea4cc882c00170de66aae01216b52692b60af46a2d5be64804f5565a03016716d17bbe5e413f38dceebc9b7238abaf756b50d519236044dde2f2ae1925b
7
- data.tar.gz: 3031b322e69a2235ff388756adf89306e5dfa9cdad639bff79b122339e93b6c8b638cab8ff4f2b4c41592bfb62df05b0c32f8eb3c2a3d6c22f0963b1017cb9d0
6
+ metadata.gz: b7510ded1c607eb0518bdb249c089fc98d53c809193db7e5b89b32f9ea11ed21165a1471dcc217b56b0a16062f643e5a301a7e0deb7041527f9063898c2ed6bc
7
+ data.tar.gz: 9647b56bd833b7c987cff438420250c39549e79b88481b644518f216ef0d82cf7e154b9c602b108084b1e3f9557a3f5c109304970223c5d2d2aa32c274abe646
@@ -0,0 +1,87 @@
1
+ name: "Package and release gems with precompiled binaries"
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ release:
6
+ description: "If the whole build passes on all platforms, release the gems on RubyGems.org"
7
+ required: false
8
+ type: boolean
9
+ default: false
10
+ jobs:
11
+ compile:
12
+ timeout-minutes: 20
13
+ name: "Cross compile the gem on different ruby versions"
14
+ strategy:
15
+ matrix:
16
+ os: ["macos-latest", "ubuntu-22.04", "ubuntu-22.04-arm", "macos-15-intel"]
17
+ runs-on: "${{ matrix.os }}"
18
+ steps:
19
+ - name: "Checkout code"
20
+ uses: "actions/checkout@v5"
21
+ - name: "Setup Ruby"
22
+ uses: "ruby/setup-ruby@v1"
23
+ with:
24
+ ruby-version: "3.1.7"
25
+ bundler-cache: true
26
+ - name: "Run cibuildgem"
27
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
28
+ with:
29
+ step: "compile"
30
+ test:
31
+ timeout-minutes: 20
32
+ name: "Run the test suite"
33
+ needs: compile
34
+ strategy:
35
+ matrix:
36
+ os: ["macos-latest", "ubuntu-22.04", "ubuntu-22.04-arm", "macos-15-intel"]
37
+ rubies: ["3.1", "3.2", "3.3", "3.4", "4.0"]
38
+ type: ["cross", "native"]
39
+ runs-on: "${{ matrix.os }}"
40
+ steps:
41
+ - name: "Checkout code"
42
+ uses: "actions/checkout@v5"
43
+ - name: "Setup Ruby"
44
+ uses: "ruby/setup-ruby@v1"
45
+ with:
46
+ ruby-version: "${{ matrix.rubies }}"
47
+ bundler-cache: true
48
+ - name: "Run cibuildgem"
49
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
50
+ with:
51
+ step: "test_${{ matrix.type }}"
52
+ install:
53
+ timeout-minutes: 5
54
+ name: "Verify the gem can be installed"
55
+ needs: test
56
+ strategy:
57
+ matrix:
58
+ os: ["macos-latest", "ubuntu-22.04", "ubuntu-22.04-arm", "macos-15-intel"]
59
+ runs-on: "${{ matrix.os }}"
60
+ steps:
61
+ - name: "Setup Ruby"
62
+ uses: "ruby/setup-ruby@v1"
63
+ with:
64
+ ruby-version: "4.0"
65
+ - name: "Run cibuildgem"
66
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
67
+ with:
68
+ step: "install"
69
+ release:
70
+ environment: release
71
+ permissions:
72
+ id-token: write
73
+ contents: read
74
+ timeout-minutes: 5
75
+ if: ${{ inputs.release }}
76
+ name: "Release all gems with RubyGems"
77
+ needs: install
78
+ runs-on: "ubuntu-latest"
79
+ steps:
80
+ - name: "Setup Ruby"
81
+ uses: "ruby/setup-ruby@v1"
82
+ with:
83
+ ruby-version: "4.0"
84
+ - name: "Run cibuildgem"
85
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
86
+ with:
87
+ step: "release"
@@ -10,7 +10,7 @@ jobs:
10
10
  - name: Set up Ruby
11
11
  uses: ruby/setup-ruby@v1
12
12
  with:
13
- ruby-version: '2.5'
13
+ ruby-version: '3.4'
14
14
  bundler-cache: true
15
15
  - name: Run linters
16
16
  run: |
@@ -20,7 +20,7 @@ jobs:
20
20
  runs-on: ubuntu-latest
21
21
  strategy:
22
22
  matrix:
23
- ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1' ]
23
+ ruby: [ '3.1', '3.2', '3.3', '3.4', '4.0' ]
24
24
  name: Ruby ${{ matrix.ruby }} Tests
25
25
  steps:
26
26
  - uses: actions/checkout@v3
data/.rubocop.yml CHANGED
@@ -10,6 +10,9 @@ AllCops:
10
10
  Style/MethodCallWithArgsParentheses:
11
11
  Enabled: false
12
12
 
13
+ Style/RedundantBegin:
14
+ Enabled: false
15
+
13
16
  Naming/FileName:
14
17
  Enabled: false
15
18
 
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.1
data/Gemfile.lock CHANGED
@@ -1,46 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heap-profiler (0.6.0)
4
+ heap-profiler (0.8.0.rc1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.1)
10
- benchmark-ips (2.8.4)
11
- byebug (11.1.3)
12
- minitest (5.14.3)
13
- parallel (1.20.1)
14
- parser (3.0.0.0)
9
+ ast (2.4.3)
10
+ benchmark-ips (2.14.0)
11
+ byebug (12.0.0)
12
+ json (2.17.1)
13
+ language_server-protocol (3.17.0.5)
14
+ lint_roller (1.1.0)
15
+ minitest (5.26.2)
16
+ parallel (1.27.0)
17
+ parser (3.3.10.0)
15
18
  ast (~> 2.4.1)
16
- rainbow (3.0.0)
17
- rake (13.0.3)
18
- rake-compiler (1.1.1)
19
+ racc
20
+ prism (1.6.0)
21
+ racc (1.8.1)
22
+ rainbow (3.1.1)
23
+ rake (13.3.1)
24
+ rake-compiler (1.3.0)
19
25
  rake
20
- regexp_parser (2.0.3)
21
- rexml (3.2.5)
22
- rubocop (1.8.1)
26
+ regexp_parser (2.11.3)
27
+ rubocop (1.81.7)
28
+ json (~> 2.3)
29
+ language_server-protocol (~> 3.17.0.2)
30
+ lint_roller (~> 1.1.0)
23
31
  parallel (~> 1.10)
24
- parser (>= 3.0.0.0)
32
+ parser (>= 3.3.0.2)
25
33
  rainbow (>= 2.2.2, < 4.0)
26
- regexp_parser (>= 1.8, < 3.0)
27
- rexml
28
- rubocop-ast (>= 1.2.0, < 2.0)
34
+ regexp_parser (>= 2.9.3, < 3.0)
35
+ rubocop-ast (>= 1.47.1, < 2.0)
29
36
  ruby-progressbar (~> 1.7)
30
- unicode-display_width (>= 1.4.0, < 3.0)
31
- rubocop-ast (1.4.0)
32
- parser (>= 2.7.1.5)
37
+ unicode-display_width (>= 2.4.0, < 4.0)
38
+ rubocop-ast (1.48.0)
39
+ parser (>= 3.3.7.2)
40
+ prism (~> 1.4)
33
41
  rubocop-shopify (1.0.7)
34
42
  rubocop (~> 1.4)
35
- ruby-progressbar (1.11.0)
36
- stackprof (0.2.16)
37
- unicode-display_width (2.0.0)
43
+ ruby-progressbar (1.13.0)
44
+ stackprof (0.2.27)
45
+ unicode-display_width (3.2.0)
46
+ unicode-emoji (~> 4.1)
47
+ unicode-emoji (4.2.0)
38
48
 
39
49
  PLATFORMS
40
- arm64-darwin-21
41
- arm64-darwin-22
42
- x86_64-darwin-19
50
+ aarch64-linux
51
+ arm64-darwin-23
52
+ arm64-darwin-25
43
53
  x86_64-darwin-20
54
+ x86_64-darwin-22
55
+ x86_64-darwin-24
44
56
  x86_64-linux
45
57
 
46
58
  DEPENDENCIES
@@ -54,4 +66,4 @@ DEPENDENCIES
54
66
  stackprof
55
67
 
56
68
  BUNDLED WITH
57
- 2.2.22
69
+ 2.5.10
data/dev.yml CHANGED
@@ -3,7 +3,7 @@ name: heap-profiler
3
3
  type: ruby
4
4
 
5
5
  up:
6
- - ruby: 2.7.2
6
+ - ruby
7
7
  - bundler
8
8
 
9
9
  commands:
@@ -19,6 +19,7 @@ module HeapProfiler
19
19
  @report_directory = report_directory
20
20
  @allocated = open_dump('allocated')
21
21
  @generation = Integer(File.read(File.join(report_directory, 'generation.info')))
22
+ @generation = nil if @generation == 0
22
23
  end
23
24
 
24
25
  def allocated_diff
@@ -74,5 +74,10 @@ module HeapProfiler
74
74
  end
75
75
  end
76
76
  end
77
- require "heap_profiler/heap_profiler"
77
+
78
+ begin
79
+ require "heap_profiler/#{RUBY_VERSION[/^\d+\.\d+/]}/heap_profiler"
80
+ rescue LoadError
81
+ require "heap_profiler/heap_profiler"
82
+ end
78
83
  end
@@ -35,9 +35,11 @@ module HeapProfiler
35
35
  @dir_path = dir_path
36
36
  @enable_tracing = !allocation_tracing_enabled?
37
37
  @generation = nil
38
+ @partial = true
38
39
  end
39
40
 
40
- def start
41
+ def start(partial: true)
42
+ @partial = partial
41
43
  FileUtils.mkdir_p(@dir_path)
42
44
  ObjectSpace.trace_object_allocations_start if @enable_tracing
43
45
 
@@ -46,7 +48,7 @@ module HeapProfiler
46
48
 
47
49
  HeapProfiler.name_anonymous_modules!
48
50
 
49
- 4.times { GC.start }
51
+ GC.start
50
52
  GC.disable
51
53
  @generation = GC.count
52
54
  end
@@ -60,11 +62,11 @@ module HeapProfiler
60
62
  dump_heap(@allocated_heap)
61
63
 
62
64
  GC.enable
63
- 4.times { GC.start }
64
- dump_heap(@retained_heap, partial: true)
65
+ GC.start
66
+ dump_heap(@retained_heap, partial: @partial)
65
67
  @allocated_heap.close
66
68
  @retained_heap.close
67
- write_info("generation", @generation.to_s)
69
+ write_info("generation", @partial ? @generation.to_s : "0")
68
70
  end
69
71
 
70
72
  def run
@@ -63,7 +63,7 @@ module HeapProfiler
63
63
 
64
64
  scale = Math.log10(bytes).div(3) * 3
65
65
  scale = 24 if scale > 24
66
- format("%.2f #{UNIT_PREFIXES[scale]}", (bytes / 10.0**scale))
66
+ format("%.2f #{UNIT_PREFIXES[scale]}", bytes / 10.0**scale)
67
67
  end
68
68
  end
69
69
 
@@ -84,8 +84,10 @@ module HeapProfiler
84
84
  analyzer = Analyzer.new(heap, index)
85
85
  dimensions = analyzer.run(@metrics, @groupings)
86
86
 
87
- io.puts "Total: #{scale_bytes(dimensions['total'].memory)} " \
88
- "(#{dimensions['total'].objects} objects)"
87
+ if dimensions['total']
88
+ io.puts "Total: #{scale_bytes(dimensions['total'].memory)} " \
89
+ "(#{dimensions['total'].objects} objects)"
90
+ end
89
91
 
90
92
  @metrics.each do |metric|
91
93
  next unless GROUPED_METRICS.include?(metric)
@@ -13,10 +13,10 @@ module HeapProfiler
13
13
  class << self
14
14
  attr_accessor :current_reporter
15
15
 
16
- def start(dir)
16
+ def start(dir, **kwargs)
17
17
  return if current_reporter
18
18
  self.current_reporter = Reporter.new(dir)
19
- current_reporter.start
19
+ current_reporter.start(**kwargs)
20
20
  end
21
21
 
22
22
  def stop
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module HeapProfiler
3
- VERSION = "0.6.0"
3
+ VERSION = "0.8.0.rc1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heap-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2026-01-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make several heap dumps and summarize allocated, retained memory
14
14
  email:
@@ -19,9 +19,11 @@ extensions:
19
19
  - ext/heap_profiler/extconf.rb
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - ".github/workflows/cibuildgem.yaml"
22
23
  - ".github/workflows/tests.yml"
23
24
  - ".gitignore"
24
25
  - ".rubocop.yml"
26
+ - ".ruby-version"
25
27
  - Gemfile
26
28
  - Gemfile.lock
27
29
  - LICENSE.txt
@@ -63,7 +65,7 @@ metadata:
63
65
  allowed_push_host: https://rubygems.org/
64
66
  homepage_uri: https://github.com/Shopify/heap-profiler
65
67
  source_code_uri: https://github.com/Shopify/heap-profiler
66
- post_install_message:
68
+ post_install_message:
67
69
  rdoc_options: []
68
70
  require_paths:
69
71
  - lib
@@ -74,12 +76,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
76
  version: 2.5.0
75
77
  required_rubygems_version: !ruby/object:Gem::Requirement
76
78
  requirements:
77
- - - ">="
79
+ - - ">"
78
80
  - !ruby/object:Gem::Version
79
- version: '0'
81
+ version: 1.3.1
80
82
  requirements: []
81
- rubygems_version: 3.3.7
82
- signing_key:
83
+ rubygems_version: 3.3.27
84
+ signing_key:
83
85
  specification_version: 4
84
86
  summary: Ruby heap profiling tool
85
87
  test_files: []