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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97eadc619870ae964e5bf61e925791d4399c0480775aadc5af31597535ae0374
4
- data.tar.gz: 5327fd25cfac20752905f89126e8f6a4422e8cc90c134bab98a47b7132f7909d
3
+ metadata.gz: 9d826cc1605b081bf6784ff46e1e49b09958f3c2626637d3d994b967bc52b391
4
+ data.tar.gz: 743a02e32629c961795ab0a4b62f839e5bf905e3a4f339f6534157cd257f2e7a
5
5
  SHA512:
6
- metadata.gz: f0fd5a598a03f41a0d5984d4652f3f85dece310ca83c015b554b85271cda220ca2535c198d4d62dad39532861ff38c858cb1048e46c29a43ce25c4fcb318ba7f
7
- data.tar.gz: d7e0462723a56f1e7a1cef5c96f2a86958df9b129442defa7814c2b5dc8d2844a1507abf0ea486d7a0458257347e9cf243d6f369568258bbdde0fa374a9d7268
6
+ metadata.gz: ac4dc6ea1e3f9c32ba223e96aa7eae35c62f4a4e3d503efdee643b44984f5d03638b42a4d2e25fe991e8bc49240f75541da0c0791b525782f827969f1926d50c
7
+ data.tar.gz: 4321e93946c0c2155f79326f9bf29f00bf0fab24785c1c7238b8fdf46570706d8906bf70e80241a7dadd1d1531f8c44e12b4b47584b6024cf7d47fa9fa0a432d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vernier (0.1.0)
4
+ vernier (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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 (auto& it: collector->object_frames) {
170
- const Stack &stack = *it.second;
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vernier
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vernier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn