1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:47:46 +00:00

LibJS+LibWebView+WebContent+Ladybird: Output GC-graph into a file

Instead of displaying a massive JSON in stdout, it's more practical
to save the GC-graph to a file.
This commit is contained in:
Aliaksandr Kalenik 2023-12-12 13:25:06 +01:00 committed by Andreas Kling
parent ed1bee222b
commit 57e5abae92
8 changed files with 38 additions and 13 deletions

View file

@ -192,7 +192,7 @@ public:
}
}
void dump()
AK::JsonObject dump()
{
auto graph = AK::JsonObject();
for (auto& it : m_graph) {
@ -233,7 +233,7 @@ public:
graph.set(DeprecatedString::number(it.key), node);
}
dbgln("{}", graph.to_deprecated_string());
return graph;
}
private:
@ -253,14 +253,14 @@ private:
FlatPtr m_max_block_address;
};
void Heap::dump_graph()
AK::JsonObject Heap::dump_graph()
{
HashMap<Cell*, HeapRoot> roots;
gather_roots(roots);
GraphConstructorVisitor visitor(*this, roots);
vm().bytecode_interpreter().visit_edges(visitor);
visitor.visit_all_cells();
visitor.dump();
return visitor.dump();
}
void Heap::collect_garbage(CollectionType collection_type, bool print_report)