ext/heap_profiler/heap_profiler.cpp in heap-profiler-0.4.0 vs ext/heap_profiler/heap_profiler.cpp in heap-profiler-0.5.0

- old
+ new

@@ -259,29 +259,30 @@ auto error = parser->load_many(RSTRING_PTR(arg), FIX2INT(batch_size)).get(objects); if (error != SUCCESS) { rb_raise(rb_eHeapProfilerError, "%s", error_message(error)); } + int64_t generation = -1; if (RTEST(since)) { Check_Type(since, T_FIXNUM); - int64_t generation = FIX2INT(since); - for (dom::element object : objects) { - int64_t object_generation; - if (object["generation"].get(object_generation) || object_generation < generation) { - continue; - } + generation = FIX2INT(since); + } - std::string_view file; - if (!object["file"].get(file) && file == "__hprof") { - continue; - } + for (dom::element object : objects) { + int64_t object_generation; + if (generation > -1 && object["generation"].get(object_generation) || object_generation < generation) { + continue; + } - rb_yield(make_ruby_object(object)); + std::string_view property; + if (!object["file"].get(property) && property == "__hprof") { + continue; } - } else { - for (dom::element object : objects) { - rb_yield(make_ruby_object(object)); + if (!object["struct"].get(property) && property == "ObjectTracing/allocation_info_tracer") { + continue; } + + rb_yield(make_ruby_object(object)); } return Qnil; } catch (simdjson::simdjson_error error) { if (error.error() == CAPACITY) {