Skip to content
Snippets Groups Projects
Commit 15d3a39f authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Allocations.to_hash should only contain classes

Sometimes, for whatever reason, this output may contain instances of
objects. For example, in a test script I ended up with an Enumerable
instance in the output (which then triggers an error as Enumerable
doesn't respond to #hash). I have no idea how on earth an Enumerable can
1) get initialized since it's a module 2) ends up in the output.
parent f69a60bc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -56,7 +56,11 @@ void freeobj_callback(VALUE tracepoint, void* data) {
* Copies every value in an st_table to a given Ruby Hash.
*/
static int each_count(st_data_t key, st_data_t value, st_data_t hash_ptr) {
rb_hash_aset((VALUE) hash_ptr, (VALUE) key, INT2NUM(value));
VALUE vkey = (VALUE) key;
if ( rb_obj_is_kind_of(key, rb_cClass) == Qtrue ) {
rb_hash_aset((VALUE) hash_ptr, vkey, INT2NUM(value));
}
 
return ST_CONTINUE;
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment