heap-profiler 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +2 -2
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.md +177 -169
- data/TODO.md +0 -6
- data/benchmark/address-parsing.rb +5 -2
- data/benchmark/indexing.rb +5 -2
- data/bin/generate-report +2 -0
- data/exe/heap-profiler +0 -1
- data/ext/heap_profiler/heap_profiler.cpp +95 -81
- data/heap-profiler.gemspec +1 -1
- data/lib/heap_profiler/analyzer.rb +95 -33
- data/lib/heap_profiler/diff.rb +13 -10
- data/lib/heap_profiler/dump.rb +2 -6
- data/lib/heap_profiler/full.rb +1 -1
- data/lib/heap_profiler/index.rb +27 -33
- data/lib/heap_profiler/{native.rb → parser.rb} +34 -19
- data/lib/heap_profiler/results.rb +7 -7
- data/lib/heap_profiler/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 256d6cdb2bac05e98cc52bdff4a51bae7679d1697e01ca6faaed6e6f5c505f49
|
4
|
+
data.tar.gz: 77e1b7a0bb844dd44fec8199521a117209d720ab11d5242f80d61509a9d5cf9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f17695f5e1bc2d5dfd6a63d4cabce50e40901e1ca4c65b4cf53488b1ef8e4d80197b0fe5255baa290ff07b789183ee29bf7f7f15ea4004a05561ac1e3a242bf9
|
7
|
+
data.tar.gz: 002b7125637d5b3f29fc74dd97cf2d33ed1fef5fb7249315bc74bb211ef3d95e567c6614141fd214a2a33fc67fa5d799d4a30d6668373207fd92912e83b6d3d4
|
data/.github/workflows/tests.yml
CHANGED
@@ -12,7 +12,7 @@ jobs:
|
|
12
12
|
- name: Setup Ruby
|
13
13
|
uses: ruby/setup-ruby@v1
|
14
14
|
with:
|
15
|
-
ruby-version: '2.
|
15
|
+
ruby-version: '2.5'
|
16
16
|
- name: Ruby gem cache
|
17
17
|
uses: actions/cache@v1
|
18
18
|
with:
|
@@ -33,7 +33,7 @@ jobs:
|
|
33
33
|
runs-on: ubuntu-latest
|
34
34
|
strategy:
|
35
35
|
matrix:
|
36
|
-
ruby: [ '2.6', '2.7' ]
|
36
|
+
ruby: [ '2.5', '2.6', '2.7' ]
|
37
37
|
name: Ruby ${{ matrix.ruby }} Tests
|
38
38
|
steps:
|
39
39
|
- name: Checkout code
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -33,6 +33,7 @@ GEM
|
|
33
33
|
rubocop-shopify (1.0.4)
|
34
34
|
rubocop (>= 0.85, < 0.87)
|
35
35
|
ruby-progressbar (1.10.1)
|
36
|
+
stackprof (0.2.15)
|
36
37
|
unicode-display_width (1.7.0)
|
37
38
|
|
38
39
|
PLATFORMS
|
@@ -46,6 +47,7 @@ DEPENDENCIES
|
|
46
47
|
rake
|
47
48
|
rake-compiler
|
48
49
|
rubocop-shopify
|
50
|
+
stackprof
|
49
51
|
|
50
52
|
BUNDLED WITH
|
51
53
|
2.1.4
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A memory profiler for Ruby
|
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
7
|
-
Ruby(MRI) Version 2.
|
7
|
+
Ruby(MRI) Version 2.5 and above.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -43,174 +43,182 @@ application, you can download the profile directory and do the analysis on anoth
|
|
43
43
|
|
44
44
|
```bash
|
45
45
|
$ heap-profiler path/to/report/directory
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
46
|
+
Total allocated: 3.72 kB (36 objects)
|
47
|
+
Total retained: 808.00 B (12 objects)
|
48
|
+
|
49
|
+
allocated memory by gem
|
50
|
+
-----------------------------------
|
51
|
+
3.72 kB other
|
52
|
+
|
53
|
+
allocated memory by file
|
54
|
+
-----------------------------------
|
55
|
+
3.72 kB bin/generate-report
|
56
|
+
|
57
|
+
allocated memory by location
|
58
|
+
-----------------------------------
|
59
|
+
3.17 kB bin/generate-report:34
|
60
|
+
157.00 B bin/generate-report:28
|
61
|
+
80.00 B bin/generate-report:21
|
62
|
+
72.00 B bin/generate-report:26
|
63
|
+
40.00 B bin/generate-report:31
|
64
|
+
40.00 B bin/generate-report:30
|
65
|
+
40.00 B bin/generate-report:25
|
66
|
+
40.00 B bin/generate-report:24
|
67
|
+
40.00 B bin/generate-report:23
|
68
|
+
40.00 B bin/generate-report:22
|
69
|
+
|
70
|
+
allocated memory by class
|
71
|
+
-----------------------------------
|
72
|
+
1.18 kB Class
|
73
|
+
848.00 B <iseq> (IMEMO)
|
74
|
+
597.00 B String
|
75
|
+
384.00 B <ment> (IMEMO)
|
76
|
+
200.00 B Array
|
77
|
+
192.00 B Hash
|
78
|
+
80.00 B <ifunc> (IMEMO)
|
79
|
+
80.00 B <cref> (IMEMO)
|
80
|
+
72.00 B Date
|
81
|
+
40.00 B Symbol
|
82
|
+
40.00 B SomeCustomStuff
|
83
|
+
|
84
|
+
allocated objects by gem
|
85
|
+
-----------------------------------
|
86
|
+
36 other
|
87
|
+
|
88
|
+
allocated objects by file
|
89
|
+
-----------------------------------
|
90
|
+
36 bin/generate-report
|
91
|
+
|
92
|
+
allocated objects by location
|
93
|
+
-----------------------------------
|
94
|
+
27 bin/generate-report:34
|
95
|
+
1 bin/generate-report:31
|
96
|
+
1 bin/generate-report:30
|
97
|
+
1 bin/generate-report:28
|
98
|
+
1 bin/generate-report:26
|
99
|
+
1 bin/generate-report:25
|
100
|
+
1 bin/generate-report:24
|
101
|
+
1 bin/generate-report:23
|
102
|
+
1 bin/generate-report:22
|
103
|
+
1 bin/generate-report:21
|
104
|
+
|
105
|
+
allocated objects by class
|
106
|
+
-----------------------------------
|
107
|
+
12 String
|
108
|
+
8 <ment> (IMEMO)
|
109
|
+
4 Array
|
110
|
+
2 Class
|
111
|
+
2 <iseq> (IMEMO)
|
112
|
+
2 <ifunc> (IMEMO)
|
113
|
+
2 <cref> (IMEMO)
|
114
|
+
1 Symbol
|
115
|
+
1 SomeCustomStuff
|
116
|
+
1 Hash
|
117
|
+
1 Date
|
118
|
+
|
119
|
+
retained memory by gem
|
120
|
+
-----------------------------------
|
121
|
+
808.00 B other
|
122
|
+
|
123
|
+
retained memory by file
|
124
|
+
-----------------------------------
|
125
|
+
808.00 B bin/generate-report
|
126
|
+
|
127
|
+
retained memory by location
|
128
|
+
-----------------------------------
|
129
|
+
168.00 B bin/generate-report:30
|
130
|
+
168.00 B bin/generate-report:28
|
131
|
+
160.00 B bin/generate-report:34
|
132
|
+
80.00 B bin/generate-report:21
|
133
|
+
72.00 B bin/generate-report:26
|
134
|
+
40.00 B bin/generate-report:25
|
135
|
+
40.00 B bin/generate-report:24
|
136
|
+
40.00 B bin/generate-report:23
|
137
|
+
40.00 B bin/generate-report:22
|
138
|
+
|
139
|
+
retained memory by class
|
140
|
+
-----------------------------------
|
141
|
+
336.00 B Hash
|
142
|
+
240.00 B String
|
143
|
+
80.00 B Array
|
144
|
+
72.00 B Date
|
145
|
+
40.00 B Symbol
|
146
|
+
40.00 B SomeCustomStuff
|
147
|
+
|
148
|
+
retained objects by gem
|
149
|
+
-----------------------------------
|
150
|
+
12 other
|
151
|
+
|
152
|
+
retained objects by file
|
153
|
+
-----------------------------------
|
154
|
+
12 bin/generate-report
|
155
|
+
|
156
|
+
retained objects by location
|
157
|
+
-----------------------------------
|
158
|
+
4 bin/generate-report:34
|
159
|
+
1 bin/generate-report:30
|
160
|
+
1 bin/generate-report:28
|
161
|
+
1 bin/generate-report:26
|
162
|
+
1 bin/generate-report:25
|
163
|
+
1 bin/generate-report:24
|
164
|
+
1 bin/generate-report:23
|
165
|
+
1 bin/generate-report:22
|
166
|
+
1 bin/generate-report:21
|
167
|
+
|
168
|
+
retained objects by class
|
169
|
+
-----------------------------------
|
170
|
+
6 String
|
171
|
+
2 Hash
|
172
|
+
1 Symbol
|
173
|
+
1 SomeCustomStuff
|
174
|
+
1 Date
|
175
|
+
1 Array
|
176
|
+
|
177
|
+
Allocated String Report
|
178
|
+
-----------------------------------
|
179
|
+
80.00 B 2 "foo="
|
180
|
+
2 bin/generate-report:34
|
181
|
+
|
182
|
+
80.00 B 2 "foo"
|
183
|
+
2 bin/generate-report:34
|
184
|
+
|
185
|
+
80.00 B 2 "bar="
|
186
|
+
2 bin/generate-report:34
|
187
|
+
|
188
|
+
80.00 B 2 "I am retained"
|
189
|
+
1 bin/generate-report:23
|
190
|
+
1 bin/generate-report:22
|
191
|
+
|
192
|
+
40.00 B 1 "I am retained too"
|
193
|
+
1 bin/generate-report:24
|
194
|
+
|
195
|
+
40.00 B 1 "I am allocated too"
|
196
|
+
1 bin/generate-report:31
|
197
|
+
|
198
|
+
40.00 B 1 "I am allocated"
|
199
|
+
1 bin/generate-report:30
|
200
|
+
|
201
|
+
157.00 B 1 "I am a very very long string I am a very very long string I am a very very long string I am a very very long string "
|
202
|
+
1 bin/generate-report:28
|
203
|
+
|
204
|
+
|
205
|
+
Retained String Report
|
206
|
+
-----------------------------------
|
207
|
+
80.00 B 2 "I am retained"
|
208
|
+
1 bin/generate-report:23
|
209
|
+
1 bin/generate-report:22
|
210
|
+
|
211
|
+
40.00 B 1 "foo="
|
212
|
+
1 bin/generate-report:34
|
213
|
+
|
214
|
+
40.00 B 1 "foo"
|
215
|
+
1 bin/generate-report:34
|
216
|
+
|
217
|
+
40.00 B 1 "bar="
|
218
|
+
1 bin/generate-report:34
|
219
|
+
|
220
|
+
40.00 B 1 "I am retained too"
|
221
|
+
1 bin/generate-report:24
|
214
222
|
```
|
215
223
|
|
216
224
|
### Heap Analysis
|
data/TODO.md
CHANGED
@@ -5,8 +5,11 @@ require "bundler/setup"
|
|
5
5
|
require "benchmark/ips"
|
6
6
|
require "heap_profiler/full"
|
7
7
|
|
8
|
+
native = HeapProfiler::Parser::Native.new
|
9
|
+
ruby = HeapProfiler::Parser::Ruby.new
|
10
|
+
|
8
11
|
Benchmark.ips do |x|
|
9
|
-
x.report("ruby") {
|
10
|
-
x.report("cpp") {
|
12
|
+
x.report("ruby") { ruby.parse_address("0x7f921e88a8f8") }
|
13
|
+
x.report("cpp") { native.parse_address("0x7f921e88a8f8") }
|
11
14
|
x.compare!
|
12
15
|
end
|
data/benchmark/indexing.rb
CHANGED
@@ -7,8 +7,11 @@ require "heap_profiler/full"
|
|
7
7
|
|
8
8
|
FIXTURE_PATH = File.expand_path("../../test/fixtures/diffed-heap/allocated.heap", __FILE__)
|
9
9
|
|
10
|
+
native = HeapProfiler::Parser::Native.new
|
11
|
+
ruby = HeapProfiler::Parser::Ruby.new
|
12
|
+
|
10
13
|
Benchmark.ips do |x|
|
11
|
-
x.report("ruby") {
|
12
|
-
x.report("cpp") {
|
14
|
+
x.report("ruby") { ruby.build_index(FIXTURE_PATH) }
|
15
|
+
x.report("cpp") { native.build_index(FIXTURE_PATH) }
|
13
16
|
x.compare!
|
14
17
|
end
|