MCPcopy Create free account
hub / github.com/Snapchat/Valdi / dumpHeap

Method dumpHeap

valdi/src/valdi/hermes/HermesJavaScriptContextFactory.cpp:56–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56BytesView HermesJavaScriptContextFactory::dumpHeap(std::span<IJavaScriptContext*> jsContexts,
57 JSExceptionTracker& exceptionTracker) {
58 if constexpr (shouldEnableJsHeapDump()) {
59 Valdi::JavaScriptHeapDumpBuilder heapDumpBuilder;
60
61 for (auto* jsContext : jsContexts) {
62 auto heapDump = dynamic_cast<HermesJavaScriptContext*>(jsContext)->dumpHeap(exceptionTracker);
63 if (!exceptionTracker) {
64 return BytesView();
65 }
66
67 heapDumpBuilder.appendDump(heapDump.data(), heapDump.size(), exceptionTracker);
68 if (!exceptionTracker) {
69 return BytesView();
70 }
71 }
72
73 return heapDumpBuilder.build();
74 } else {
75 exceptionTracker.onError("Heap dump support not enabled");
76 return BytesView();
77 }
78}
79
80} // namespace Valdi::Hermes

Callers

nothing calls this directly

Calls 8

shouldEnableJsHeapDumpFunction · 0.85
appendDumpMethod · 0.80
dumpHeapMethod · 0.65
onErrorMethod · 0.65
BytesViewClass · 0.50
dataMethod · 0.45
sizeMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected