memory_profiler 1.0.2 → 1.1.0

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: a33279b5aa11573ac4eb1c99c14d8ec0ac944827da175b6eef03d77bc57c652f
4
- data.tar.gz: dc21db4963eb3840031d72de3b095a1a3414265dac0cd7df06de0c83ef0b95ad
3
+ metadata.gz: d5a66fca1aa2343e5380049e2079a9949bf315ab053db4106ab591ec8f1a3b87
4
+ data.tar.gz: cf5d847031900969429d4aa295afe385375bf18582444dcc559e4171561c23b7
5
5
  SHA512:
6
- metadata.gz: 421e253a198c2bc3881f57ac9f016bf69a5644f96eef211c1073442ce45b6a79021c3af2cdd77a8f916607080127d96a991c7c4fcd7b650ef107dd93161233ee
7
- data.tar.gz: 8582b18f48088f242734d353ddd86a09ee9e2a1b2bb1ccdd1e066dd45ed29da2ef3417f2b1a82667c3863445358464f73fdc89e1e715c621d627469fc7b39be4
6
+ metadata.gz: 27898d1f93136732b68dfc3c624b20865c9a5772f017204afefe23e61295e5d00775c6b3ba73e4747d6cc5df862cc251ba6046313d54e6893187aab075442eb6
7
+ data.tar.gz: 4c2f5c257ed8a9be18b06bbe3931527e1da026ad431e00e05c10e4a3938eaa4329cc65e7fd79c89257d2994dcacb5d9e3c5d363f10993625ff362e778750a82b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0 - 17-09-2024
4
+
5
+ - Remove EOL Rubies: < 3.1 are no longer supported (use an earlier version of the gem if needed)
6
+
3
7
  ## 1.0.2 - 17-06-2024
4
8
 
5
9
  - Add ability to profile commands via CLI @fatkodima
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![CI](https://github.com/SamSaffron/memory_profiler/workflows/CI/badge.svg)](https://github.com/SamSaffron/memory_profiler/actions?query=workflow%3ACI)
1
+ [![CI](https://github.com/SamSaffron/memory_profiler/actions/workflows/ci.yml/badge.svg)](https://github.com/SamSaffron/memory_profiler/actions/workflows/ci.yml)
2
2
  [![Gem Version](https://badge.fury.io/rb/memory_profiler.svg)](https://rubygems.org/gems/memory_profiler)
3
3
 
4
4
  # MemoryProfiler
@@ -7,7 +7,7 @@ A memory profiler for Ruby
7
7
 
8
8
  ## Requirements
9
9
 
10
- Ruby(MRI) Version 2.5.0 and above.
10
+ Ruby(MRI) Version 3.1.0 and above.
11
11
 
12
12
  ## Installation
13
13
 
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "memory_profiler"
4
- require "base64"
5
4
 
6
5
  def deserialize_hash(data)
7
- Marshal.load(Base64.urlsafe_decode64(data)) if data
6
+ Marshal.load(data.unpack1("m0")) if data
8
7
  end
9
8
 
10
9
  options = deserialize_hash(ENV["MEMORY_PROFILER_OPTIONS"]) || {}
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "optparse"
4
- require "base64"
5
4
 
6
5
  module MemoryProfiler
7
6
  class CLI
@@ -141,7 +140,7 @@ module MemoryProfiler
141
140
  end
142
141
 
143
142
  def serialize_hash(hash)
144
- Base64.urlsafe_encode64(Marshal.dump(hash))
143
+ [Marshal.dump(hash)].pack("m0")
145
144
  end
146
145
  end
147
146
  end
@@ -6,7 +6,6 @@ module MemoryProfiler
6
6
  def initialize
7
7
  @gem_guess_cache = Hash.new
8
8
  @location_cache = Hash.new { |h, k| h[k] = Hash.new.compare_by_identity }
9
- @class_name_cache = Hash.new.compare_by_identity
10
9
  @string_cache = Hash.new
11
10
  end
12
11
 
@@ -30,34 +29,17 @@ module MemoryProfiler
30
29
  end
31
30
 
32
31
  KERNEL_CLASS_METHOD = Kernel.instance_method(:class)
33
- if UnboundMethod.method_defined?(:bind_call)
34
- def object_class(obj)
35
- klass = obj.class rescue nil
36
- unless Class === klass
37
- # attempt to determine the true Class when .class returns something other than a Class
38
- klass = KERNEL_CLASS_METHOD.bind_call(obj)
39
- end
40
- klass
41
- end
42
- else
43
- def object_class(obj)
44
- klass = obj.class rescue nil
45
- unless Class === klass
46
- # attempt to determine the true Class when .class returns something other than a Class
47
- klass = KERNEL_CLASS_METHOD.bind(obj).call
48
- end
49
- klass
32
+ def object_class(obj)
33
+ klass = obj.class rescue nil
34
+ unless Class === klass
35
+ # attempt to determine the true Class when .class returns something other than a Class
36
+ klass = KERNEL_CLASS_METHOD.bind_call(obj)
50
37
  end
38
+ klass
51
39
  end
52
40
 
53
- if Object.name.frozen? # Since Ruby 2.7 Module#name no longer allocate a new string
54
- def lookup_class_name(klass)
55
- ((klass.is_a?(Class) && klass.name) || '<<Unknown>>').to_s
56
- end
57
- else
58
- def lookup_class_name(klass)
59
- @class_name_cache[klass] ||= ((klass.is_a?(Class) && klass.name) || '<<Unknown>>').to_s
60
- end
41
+ def lookup_class_name(klass)
42
+ ((klass.is_a?(Class) && klass.name) || '<<Unknown>>').to_s
61
43
  end
62
44
 
63
45
  def lookup_string(obj)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MemoryProfiler
4
- VERSION = "1.0.2"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memory_profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-17 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Memory profiling routines for Ruby 2.5+
13
+ description: Memory profiling routines for Ruby 3.1+
14
14
  email:
15
15
  - sam.saffron@gmail.com
16
16
  executables:
@@ -37,7 +37,8 @@ files:
37
37
  homepage: https://github.com/SamSaffron/memory_profiler
38
38
  licenses:
39
39
  - MIT
40
- metadata: {}
40
+ metadata:
41
+ changelog_uri: https://github.com/SamSaffron/memory_profiler/blob/master/CHANGELOG.md
41
42
  post_install_message:
42
43
  rdoc_options: []
43
44
  require_paths:
@@ -46,7 +47,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
47
  requirements:
47
48
  - - ">="
48
49
  - !ruby/object:Gem::Version
49
- version: 2.5.0
50
+ version: 3.1.0
50
51
  required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  requirements:
52
53
  - - ">="
@@ -56,5 +57,5 @@ requirements: []
56
57
  rubygems_version: 3.5.11
57
58
  signing_key:
58
59
  specification_version: 4
59
- summary: Memory profiling routines for Ruby 2.5+
60
+ summary: Memory profiling routines for Ruby 3.1+
60
61
  test_files: []