allocations 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb4fcbc39ec1eab5fe4831d66b372a71ea0d0d4a
4
- data.tar.gz: 5abee9e95a64a77c97efce6ee84fc3423f83f4a5
3
+ metadata.gz: 9f684c28383cf0174b1410aacedd436771f14603
4
+ data.tar.gz: c8cb8d726e5edbe6a81005c65ffce812a4688c6a
5
5
  SHA512:
6
- metadata.gz: c03ec7031bd717eac4bec3ff0939fec83549bec9eafa8696d76898fbe66d5a1d2809a63fce601b0007a5b4723d3029565eee001b48bcd76a9029144a51b9fe4e
7
- data.tar.gz: d3eaf46688c14434715dc5b567a4da61eb7435e2e4c4bd904d27e357311a20088567d70d517fe0665148e0329bfe374513682f51f5dab4bc5f70edcdf0617c47
6
+ metadata.gz: f17e896bcb848cbbcc59cf5bee39ba3baf318eb995bacf90df28b654143b07a2670a1c55f6e692ac7475f67515783987b56614af01804e70799dc4f6e926f45c
7
+ data.tar.gz: 325c979378375a49ac0d233abc3cd1bea91b903765dcd9fe7c66a34e52e9b1dd7b01e08fb675179c814f830409cab05d5f4fad51fb7bae9dfddff9758df59239
data/README.md CHANGED
@@ -56,12 +56,9 @@ Disable it again and clear any existing statistics:
56
56
 
57
57
  ## Thread Safety
58
58
 
59
- The C extension uses a mutex to ensure the various methods provided by this Gem
60
- can be used in different threads simultaneously. Each call to
61
- `Allocations.to_hash` returns a new Hash containing a copy of the current
62
- statistics (instead of just referring to a single global Hash).
63
-
64
- Do note that calling `Allocation.start` and `Allocations.stop` affects _all_
59
+ This C extension does not use any internal locking and instead relies on the GIL
60
+ to prevent multiple Ruby threads from accessing the allocation data in parallel.
61
+ Note that calling `Allocation.start` and `Allocations.stop` also affects _all_
65
62
  running threads instead of only the current thread.
66
63
 
67
64
  ## License
@@ -56,7 +56,11 @@ void freeobj_callback(VALUE tracepoint, void* data) {
56
56
  * Copies every value in an st_table to a given Ruby Hash.
57
57
  */
58
58
  static int each_count(st_data_t key, st_data_t value, st_data_t hash_ptr) {
59
- rb_hash_aset((VALUE) hash_ptr, (VALUE) key, INT2NUM(value));
59
+ VALUE vkey = (VALUE) key;
60
+
61
+ if ( rb_obj_is_kind_of(key, rb_cClass) == Qtrue ) {
62
+ rb_hash_aset((VALUE) hash_ptr, vkey, INT2NUM(value));
63
+ }
60
64
 
61
65
  return ST_CONTINUE;
62
66
  }
@@ -1,3 +1,3 @@
1
1
  module Allocations
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allocations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-31 00:00:00.000000000 Z
11
+ date: 2016-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.2.5
104
+ rubygems_version: 2.5.1
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Tracking of retained objects in CRuby