memory_profiler 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/memory_profiler/autorun.rb +1 -2
- data/lib/memory_profiler/cli.rb +1 -2
- data/lib/memory_profiler/helpers.rb +8 -26
- data/lib/memory_profiler/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5a66fca1aa2343e5380049e2079a9949bf315ab053db4106ab591ec8f1a3b87
|
4
|
+
data.tar.gz: cf5d847031900969429d4aa295afe385375bf18582444dcc559e4171561c23b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27898d1f93136732b68dfc3c624b20865c9a5772f017204afefe23e61295e5d00775c6b3ba73e4747d6cc5df862cc251ba6046313d54e6893187aab075442eb6
|
7
|
+
data.tar.gz: 4c2f5c257ed8a9be18b06bbe3931527e1da026ad431e00e05c10e4a3938eaa4329cc65e7fd79c89257d2994dcacb5d9e3c5d363f10993625ff362e778750a82b
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![CI](https://github.com/SamSaffron/memory_profiler/workflows/
|
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
|
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(
|
6
|
+
Marshal.load(data.unpack1("m0")) if data
|
8
7
|
end
|
9
8
|
|
10
9
|
options = deserialize_hash(ENV["MEMORY_PROFILER_OPTIONS"]) || {}
|
data/lib/memory_profiler/cli.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
54
|
-
|
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)
|
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
|
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-
|
11
|
+
date: 2024-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Memory profiling routines for Ruby
|
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:
|
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
|
60
|
+
summary: Memory profiling routines for Ruby 3.1+
|
60
61
|
test_files: []
|