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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd1bb47a992405f240fc5b4cc0da81eab1c834184407fabafa98e466e119d890
4
- data.tar.gz: b54e6472ed171723cb765002834fc9ef385d977d659aa96bddc5d7f5dff0428d
3
+ metadata.gz: 256d6cdb2bac05e98cc52bdff4a51bae7679d1697e01ca6faaed6e6f5c505f49
4
+ data.tar.gz: 77e1b7a0bb844dd44fec8199521a117209d720ab11d5242f80d61509a9d5cf9a
5
5
  SHA512:
6
- metadata.gz: b052ccea980716b84308ffdfe490916c84cd796dcb40a4329b15d48097955a50ec576f6d440bfc6b143800dd8af2509d82ad675c1f7845ca44850ba6c161a36c
7
- data.tar.gz: a70adefc9b02b9b22792d94775d982ca6148d45d56ebb47b97ca327e00eabe5ff0fafa663f1eb251a16b143eca6e4f790566c976ada0244f7492646608ab808a
6
+ metadata.gz: f17695f5e1bc2d5dfd6a63d4cabce50e40901e1ca4c65b4cf53488b1ef8e4d80197b0fe5255baa290ff07b789183ee29bf7f7f15ea4004a05561ac1e3a242bf9
7
+ data.tar.gz: 002b7125637d5b3f29fc74dd97cf2d33ed1fef5fb7249315bc74bb211ef3d95e567c6614141fd214a2a33fc67fa5d799d4a30d6668373207fd92912e83b6d3d4
@@ -12,7 +12,7 @@ jobs:
12
12
  - name: Setup Ruby
13
13
  uses: ruby/setup-ruby@v1
14
14
  with:
15
- ruby-version: '2.6'
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
@@ -10,3 +10,4 @@ gem "minitest", "~> 5.0"
10
10
  gem "byebug"
11
11
  gem "rubocop-shopify", require: false
12
12
  gem "benchmark-ips"
13
+ gem "stackprof"
@@ -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.6 and above.
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
- Total allocated: 3.64 kB (35 objects)
47
- Total retained: 728.00 B (11 objects)
48
-
49
- allocated memory by gem
50
- -----------------------------------
51
- 3.64 kB other
52
-
53
- allocated memory by file
54
- -----------------------------------
55
- 3.64 kB bin/generate-report
56
-
57
- allocated memory by location
58
- -----------------------------------
59
- 3.17 kB bin/generate-report:32
60
- 157.00 B bin/generate-report:26
61
- 72.00 B bin/generate-report:20
62
- 40.00 B bin/generate-report:29
63
- 40.00 B bin/generate-report:28
64
- 40.00 B bin/generate-report:24
65
- 40.00 B bin/generate-report:23
66
- 40.00 B bin/generate-report:22
67
- 40.00 B bin/generate-report:21
68
-
69
- allocated memory by class
70
- -----------------------------------
71
- 1.18 kB Class
72
- 848.00 B <iseq> (IMEMO)
73
- 597.00 B String
74
- 384.00 B <ment> (IMEMO)
75
- 192.00 B Hash
76
- 192.00 B Array
77
- 80.00 B <ifunc> (IMEMO)
78
- 80.00 B <cref> (IMEMO)
79
- 40.00 B Symbol
80
- 40.00 B SomeCustomStuff
81
-
82
- allocated objects by gem
83
- -----------------------------------
84
- 35 other
85
-
86
- allocated objects by file
87
- -----------------------------------
88
- 35 bin/generate-report
89
-
90
- allocated objects by location
91
- -----------------------------------
92
- 27 bin/generate-report:32
93
- 1 bin/generate-report:29
94
- 1 bin/generate-report:28
95
- 1 bin/generate-report:26
96
- 1 bin/generate-report:24
97
- 1 bin/generate-report:23
98
- 1 bin/generate-report:22
99
- 1 bin/generate-report:21
100
- 1 bin/generate-report:20
101
-
102
- allocated objects by class
103
- -----------------------------------
104
- 12 String
105
- 8 <ment> (IMEMO)
106
- 4 Array
107
- 2 Class
108
- 2 <iseq> (IMEMO)
109
- 2 <ifunc> (IMEMO)
110
- 2 <cref> (IMEMO)
111
- 1 Symbol
112
- 1 SomeCustomStuff
113
- 1 Hash
114
-
115
- retained memory by gem
116
- -----------------------------------
117
- 728.00 B other
118
-
119
- retained memory by file
120
- -----------------------------------
121
- 728.00 B bin/generate-report
122
-
123
- retained memory by location
124
- -----------------------------------
125
- 168.00 B bin/generate-report:28
126
- 168.00 B bin/generate-report:26
127
- 160.00 B bin/generate-report:32
128
- 72.00 B bin/generate-report:20
129
- 40.00 B bin/generate-report:24
130
- 40.00 B bin/generate-report:23
131
- 40.00 B bin/generate-report:22
132
- 40.00 B bin/generate-report:21
133
-
134
- retained memory by class
135
- -----------------------------------
136
- 336.00 B Hash
137
- 240.00 B String
138
- 72.00 B Array
139
- 40.00 B Symbol
140
- 40.00 B SomeCustomStuff
141
-
142
- retained objects by gem
143
- -----------------------------------
144
- 11 other
145
-
146
- retained objects by file
147
- -----------------------------------
148
- 11 bin/generate-report
149
-
150
- retained objects by location
151
- -----------------------------------
152
- 4 bin/generate-report:32
153
- 1 bin/generate-report:28
154
- 1 bin/generate-report:26
155
- 1 bin/generate-report:24
156
- 1 bin/generate-report:23
157
- 1 bin/generate-report:22
158
- 1 bin/generate-report:21
159
- 1 bin/generate-report:20
160
-
161
- retained objects by class
162
- -----------------------------------
163
- 6 String
164
- 2 Hash
165
- 1 Symbol
166
- 1 SomeCustomStuff
167
- 1 Array
168
-
169
- Allocated String Report
170
- -----------------------------------
171
- 80.00 B 2 "foo="
172
- 2 bin/generate-report:32
173
-
174
- 80.00 B 2 "foo"
175
- 2 bin/generate-report:32
176
-
177
- 80.00 B 2 "bar="
178
- 2 bin/generate-report:32
179
-
180
- 80.00 B 2 "I am retained"
181
- 1 bin/generate-report:22
182
- 1 bin/generate-report:21
183
-
184
- 40.00 B 1 "I am retained too"
185
- 1 bin/generate-report:23
186
-
187
- 40.00 B 1 "I am allocated too"
188
- 1 bin/generate-report:29
189
-
190
- 40.00 B 1 "I am allocated"
191
- 1 bin/generate-report:28
192
-
193
- 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 "
194
- 1 bin/generate-report:26
195
-
196
-
197
- Retained String Report
198
- -----------------------------------
199
- 80.00 B 2 "I am retained"
200
- 1 bin/generate-report:22
201
- 1 bin/generate-report:21
202
-
203
- 40.00 B 1 "foo="
204
- 1 bin/generate-report:32
205
-
206
- 40.00 B 1 "foo"
207
- 1 bin/generate-report:32
208
-
209
- 40.00 B 1 "bar="
210
- 1 bin/generate-report:32
211
-
212
- 40.00 B 1 "I am retained too"
213
- 1 bin/generate-report:23
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
@@ -1,9 +1,3 @@
1
- ### Important
2
-
3
- - Test with other Ruby versions.
4
-
5
1
  ### Explore
6
2
 
7
- - Performance optimization.
8
- - Would filtering on the `generation` field be faster than the address extraction?
9
3
  - Detect object growth?
@@ -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") { HeapProfiler::Native.ruby_parse_address("0x7f921e88a8f8") }
10
- x.report("cpp") { HeapProfiler::Native.parse_address("0x7f921e88a8f8") }
12
+ x.report("ruby") { ruby.parse_address("0x7f921e88a8f8") }
13
+ x.report("cpp") { native.parse_address("0x7f921e88a8f8") }
11
14
  x.compare!
12
15
  end
@@ -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") { HeapProfiler::Native.ruby_build_index(FIXTURE_PATH) }
12
- x.report("cpp") { HeapProfiler::Native.build_index(FIXTURE_PATH) }
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