memprof2 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/README.md +25 -1
- data/example.rb +7 -0
- data/lib/memprof2.rb +8 -0
- data/memprof2.gemspec +1 -1
- data/test/test_memprof2.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c9ce828abc8d8a17b915fee8fa2ab9cbc146e94b60266110440c5b2be6ea5002
|
4
|
+
data.tar.gz: 4b27bd87a42decfcf2a0c09ec650e266a6c23f5ca2cb49a14dc135e41c807850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45454dcdf9079e9c1fc66f3da0b4fdde5f86741930dc415c05975030738a5c9c532e380475c4d15ff4b34a69cdcea1e07c6304b41711e8023ec851da1cf830cc
|
7
|
+
data.tar.gz: 5b5978fadb7f0293ace9ec32435ee6fe4ba753a522f636d5083503269e75f6dfc5b17e65ca9ea89fe0422f8617a10725946a57023571632cf55861ef03297107
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -68,9 +68,19 @@ After `GC.start`, only the very last instance of `"abc"` will still exist:
|
|
68
68
|
|
69
69
|
*Note*: Use `Memprof2.report!` to clear out tracking data after printing out results.
|
70
70
|
|
71
|
+
Use `trace` and `ignore` options to restrict files to report. You can write patterns by regular expressions:
|
72
|
+
|
73
|
+
```
|
74
|
+
Memprof2.start
|
75
|
+
10.times{ $last_str = "abc" }
|
76
|
+
GC.start
|
77
|
+
Memprof2.report!(trace: /file\.rb/, ignore: /ignore_me/, out: "/path/to/file")
|
78
|
+
Memprof2.stop
|
79
|
+
```
|
80
|
+
|
71
81
|
## Memprof2.run
|
72
82
|
|
73
|
-
|
83
|
+
A shorthand for `Memprof2.start/stop` that will start/stop memprof around a given block of ruby code.
|
74
84
|
|
75
85
|
```ruby
|
76
86
|
Memprof2.run do
|
@@ -91,6 +101,20 @@ For the block of ruby code, print out file:line:class pairs for ruby objects cre
|
|
91
101
|
|
92
102
|
*Note*: You can call GC.start at the end of the block to print out only objects that are 'leaking' (i.e. objects that still have inbound references).
|
93
103
|
|
104
|
+
## Memprof2.run_with_report
|
105
|
+
|
106
|
+
A shorthand for `Memprof2.start/report/stop`.
|
107
|
+
|
108
|
+
Following codes work exactly same with the above example.
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
Memprof2.run_with_report(out: "/path/to/file") do
|
112
|
+
100.times{ "abc" }
|
113
|
+
100.times{ 1.23 + 1 }
|
114
|
+
100.times{ Module.new }
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
94
118
|
## ChangeLog
|
95
119
|
|
96
120
|
See [CHANGELOG.md](CHANGELOG.md) for details.
|
data/example.rb
CHANGED
data/lib/memprof2.rb
CHANGED
data/memprof2.gemspec
CHANGED
data/test/test_memprof2.rb
CHANGED
@@ -50,4 +50,12 @@ class TestMemprof2 < Test::Unit::TestCase
|
|
50
50
|
assert_match("test/test_memprof2.rb:46:String\n", File.read(opts_bang[:out]))
|
51
51
|
assert_match("", File.read(opts[:out]))
|
52
52
|
end
|
53
|
+
|
54
|
+
def test_run_with_result
|
55
|
+
opts = {out: "tmp/test_run_with_report.out"}
|
56
|
+
Memprof2.run_with_report(opts) do
|
57
|
+
a = "abc"
|
58
|
+
end
|
59
|
+
assert_match("test/test_memprof2.rb:57:String\n", File.read(opts[:out]))
|
60
|
+
end
|
53
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memprof2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.7.6
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: Ruby memory profiler for >= Ruby 2.1.0
|