vernier 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/ext/vernier/vernier.cc +8 -6
- data/lib/vernier/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d826cc1605b081bf6784ff46e1e49b09958f3c2626637d3d994b967bc52b391
|
4
|
+
data.tar.gz: 743a02e32629c961795ab0a4b62f839e5bf905e3a4f339f6534157cd257f2e7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac4dc6ea1e3f9c32ba223e96aa7eae35c62f4a4e3d503efdee643b44984f5d03638b42a4d2e25fe991e8bc49240f75541da0c0791b525782f827969f1926d50c
|
7
|
+
data.tar.gz: 4321e93946c0c2155f79326f9bf29f00bf0fab24785c1c7238b8fdf46570706d8906bf70e80241a7dadd1d1531f8c44e12b4b47584b6024cf7d47fa9fa0a432d
|
data/Gemfile.lock
CHANGED
data/ext/vernier/vernier.cc
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
#include <algorithm>
|
5
5
|
#include <sstream>
|
6
6
|
#include <unordered_map>
|
7
|
+
#include <unordered_set>
|
7
8
|
|
8
9
|
#include "vernier.hh"
|
9
10
|
#include "stack.hh"
|
@@ -19,6 +20,7 @@ struct retained_collector {
|
|
19
20
|
int allocated_objects = 0;
|
20
21
|
int freed_objects = 0;
|
21
22
|
|
23
|
+
std::unordered_set<VALUE> unique_frames;
|
22
24
|
std::unordered_map<VALUE, std::unique_ptr<Stack>> object_frames;
|
23
25
|
};
|
24
26
|
|
@@ -54,6 +56,10 @@ newobj_i(VALUE tpval, void *data) {
|
|
54
56
|
int lines_buffer[2048];
|
55
57
|
int n = rb_profile_frames(0, 2048, frames_buffer, lines_buffer);
|
56
58
|
|
59
|
+
for (int i = 0; i < n; i++) {
|
60
|
+
collector->unique_frames.insert(frames_buffer[i]);
|
61
|
+
}
|
62
|
+
|
57
63
|
collector->object_frames.emplace(
|
58
64
|
tp.obj,
|
59
65
|
make_unique<Stack>(frames_buffer, lines_buffer, n)
|
@@ -166,12 +172,8 @@ retained_collector_mark(void *data) {
|
|
166
172
|
// We don't mark the objects, but we MUST mark the frames, otherwise they
|
167
173
|
// can be garbage collected.
|
168
174
|
// This may lead to method entries being unnecessarily retained.
|
169
|
-
for (
|
170
|
-
|
171
|
-
|
172
|
-
for (int i = 0; i < stack.size(); i++) {
|
173
|
-
rb_gc_mark(stack.frames[i]);
|
174
|
-
}
|
175
|
+
for (VALUE frame: collector->unique_frames) {
|
176
|
+
rb_gc_mark(frame);
|
175
177
|
}
|
176
178
|
}
|
177
179
|
|
data/lib/vernier/version.rb
CHANGED