ext/heap_profiler/heap_profiler.cpp in heap-profiler-0.5.0 vs ext/heap_profiler/heap_profiler.cpp in heap-profiler-0.6.0
- old
+ new
@@ -5,11 +5,11 @@
using namespace simdjson;
static VALUE rb_eHeapProfilerError, rb_eHeapProfilerCapacityError, sym_type, sym_class,
sym_address, sym_value, sym_memsize, sym_imemo_type, sym_struct, sym_file,
- sym_line, sym_shared, sym_references, id_uminus;
+ sym_line, sym_shared, sym_references, sym_edge_name, id_uminus;
typedef struct {
dom::parser *parser;
} parser_t;
@@ -188,12 +188,15 @@
if (!object["address"].get(address)) {
rb_hash_aset(hash, sym_address, INT2FIX(parse_address(address)));
}
std::string_view _class;
- if (!object["class"].get(_class)) {
- rb_hash_aset(hash, sym_class, INT2FIX(parse_address(_class)));
+ if (type != "IMEMO") {
+ // IMEMO "class" field can sometime be junk
+ if (!object["class"].get(_class)) {
+ rb_hash_aset(hash, sym_class, INT2FIX(parse_address(_class)));
+ }
}
uint64_t memsize;
if (object["memsize"].get(memsize)) {
// ROOT object
@@ -231,10 +234,15 @@
}
}
rb_hash_aset(hash, sym_references, references);
}
}
+ } else if (type == "SHAPE") {
+ std::string_view edge_name;
+ if (!object["edge_name"].get(edge_name)) {
+ rb_hash_aset(hash, sym_edge_name, make_string(edge_name));
+ }
}
std::string_view file;
if (!object["file"].get(file)) {
rb_hash_aset(hash, sym_file, dedup_string(file));
@@ -297,9 +305,10 @@
extern "C" {
void Init_heap_profiler(void) {
sym_type = ID2SYM(rb_intern("type"));
sym_class = ID2SYM(rb_intern("class"));
sym_address = ID2SYM(rb_intern("address"));
+ sym_edge_name = ID2SYM(rb_intern("edge_name"));
sym_value = ID2SYM(rb_intern("value"));
sym_memsize = ID2SYM(rb_intern("memsize"));
sym_struct = ID2SYM(rb_intern("struct"));
sym_imemo_type = ID2SYM(rb_intern("imemo_type"));
sym_file = ID2SYM(rb_intern("file"));