memory 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/memory/sampler.rb +5 -1
- data/lib/memory/version.rb +2 -2
- data/license.md +1 -1
- data/readme.md +15 -16
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 007d5f4bf3d0a25dc887eefc4c7467f44a021e0658a4ac6acfe186da4c72c435
|
4
|
+
data.tar.gz: dcc7e341db91dccf9f3928d3eb7901606e31fc3df9bb7701c1ad3c1253e7d2c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5831fce8f53208b08a5c2fab8f0d4286077fbe69a9d1fe227888695be775259743f098fb8ef1a2dce9843e478ddcc7f66e37142567f79df9bbfe20f694ffbc
|
7
|
+
data.tar.gz: fac10ba0b56492a1d870217d31c92fb20e35c9cdb65dfb44d5b7bec41d673b0ccb2631f4d913575fa40474c5eaddece64e821c63cbd2f86819fb9f6b5b305a3c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/memory/sampler.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# Copyright, 2018, by Jonas Peschla.
|
12
12
|
# Copyright, 2018, by Espartaco Palma.
|
13
13
|
# Copyright, 2020, by Jean Boussier.
|
14
|
-
# Copyright, 2020-
|
14
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
15
15
|
|
16
16
|
require 'objspace'
|
17
17
|
require 'msgpack'
|
@@ -67,6 +67,10 @@ module Memory
|
|
67
67
|
@allocated = Array.new
|
68
68
|
end
|
69
69
|
|
70
|
+
def inspect
|
71
|
+
"#<#{self.class} #{@allocated.size} allocations>"
|
72
|
+
end
|
73
|
+
|
70
74
|
attr :filter
|
71
75
|
|
72
76
|
attr :cache
|
data/lib/memory/version.rb
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
# Copyright, 2013-2019, by Sam Saffron.
|
5
5
|
# Copyright, 2015-2016, by Dave Gynn.
|
6
6
|
# Copyright, 2018, by Jonas Peschla.
|
7
|
-
# Copyright, 2020-
|
7
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
8
8
|
|
9
9
|
module Memory
|
10
|
-
VERSION = "0.4.
|
10
|
+
VERSION = "0.4.2"
|
11
11
|
end
|
data/license.md
CHANGED
@@ -24,7 +24,7 @@ Copyright, 2019-2020, by Jean Boussier.
|
|
24
24
|
Copyright, 2019, by Ashwin Maroli.
|
25
25
|
Copyright, 2019, by Olle Jonsson.
|
26
26
|
Copyright, 2019, by Danny Ben Shitrit.
|
27
|
-
Copyright, 2020-
|
27
|
+
Copyright, 2020-2024, by Samuel Williams.
|
28
28
|
|
29
29
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
30
30
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -49,41 +49,40 @@ report.print
|
|
49
49
|
``` ruby
|
50
50
|
memory_sampler = nil
|
51
51
|
config.before(:all) do |example_group|
|
52
|
-
name = example_group.class.description.gsub(/[^\w]+/,
|
52
|
+
name = example_group.class.description.gsub(/[^\w]+/, '-')
|
53
53
|
path = "#{name}.mprof"
|
54
|
-
|
54
|
+
|
55
55
|
skip if File.exist?(path)
|
56
|
-
|
56
|
+
|
57
57
|
memory_sampler = Memory::Sampler.new
|
58
58
|
memory_sampler.start
|
59
59
|
end
|
60
60
|
|
61
61
|
config.after(:all) do |example_group|
|
62
|
-
name = example_group.class.description.gsub(/[^\w]+/,
|
62
|
+
name = example_group.class.description.gsub(/[^\w]+/, '-')
|
63
63
|
path = "#{name}.mprof"
|
64
|
-
|
64
|
+
|
65
65
|
if memory_sampler
|
66
66
|
memory_sampler.stop
|
67
|
-
|
67
|
+
|
68
68
|
File.open(path, "w", encoding: Encoding::BINARY) do |io|
|
69
69
|
memory_sampler.dump(io)
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
memory_sampler = nil
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
config.after(:suite) do
|
77
77
|
memory_sampler = Memory::Sampler.new
|
78
|
-
|
79
|
-
Dir.glob(
|
80
|
-
|
81
|
-
|
82
|
-
encoding: Encoding::BINARY,
|
83
|
-
))
|
78
|
+
|
79
|
+
Dir.glob('*.mprof') do |path|
|
80
|
+
$stderr.puts "Loading #{path}..."
|
81
|
+
memory_sampler.load(File.read(path, encoding: Encoding::BINARY))
|
84
82
|
end
|
85
|
-
|
86
|
-
|
83
|
+
|
84
|
+
$stderr.puts "Memory usage:"
|
85
|
+
memory_sampler.report.print
|
87
86
|
end
|
88
87
|
```
|
89
88
|
|
@@ -128,4 +127,4 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
|
|
128
127
|
|
129
128
|
### Contributor Covenant
|
130
129
|
|
131
|
-
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
130
|
+
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -61,7 +61,7 @@ cert_chain:
|
|
61
61
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
62
62
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
63
63
|
-----END CERTIFICATE-----
|
64
|
-
date:
|
64
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
65
65
|
dependencies:
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: bake
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
144
|
+
rubygems_version: 3.5.3
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Memory profiling routines for Ruby 2.3+
|
metadata.gz.sig
CHANGED
Binary file
|