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

Method dumpMemoryStatistics

valdi/src/valdi/jscore/JavaScriptCoreContext.cpp:308–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306 JSSynchronousGarbageCollectForDebugging(_globalContext);
307#endif
308 }
309}
310
311Valdi::JavaScriptContextMemoryStatistics JavaScriptCoreContext::dumpMemoryStatistics() {
312 if (s_dumpMemoryStatisticsOverride) {
313 return s_dumpMemoryStatisticsOverride(_globalContext);
314 }
315
316 Valdi::JavaScriptContextMemoryStatistics out;
317
318 if constexpr (!snap::kIsAppstoreBuild || !snap::isIos()) {
319 // JSGetMemoryUsageStatistics() is currently a private symbol, so we use it
320 // only on Android/Desktop or non production iOS.
321
322 if (JSGetMemoryUsageStatistics) {
323 auto memoryUsageJs = JSGetMemoryUsageStatistics(_globalContext);
324
325 if (!memoryUsageJs) {
326 return out;
327 }
328
329 Valdi::JSExceptionTracker exceptionTracker(*this);
330 auto memoryUsage = Valdi::jsValueToValue(
331 *this,
332 toValdiJSValue(JSCoreRef(memoryUsageJs, JSValueGetType(_globalContext, memoryUsageJs))),
333 Valdi::ReferenceInfoBuilder(),
334 exceptionTracker);
335
336 exceptionTracker.clearError();

Callers

nothing calls this directly

Calls 8

isIosFunction · 0.85
jsValueToValueFunction · 0.85
JSCoreRefClass · 0.85
clearErrorMethod · 0.80
toLongMethod · 0.80
getMapValueMethod · 0.80
toValdiJSValueFunction · 0.70

Tested by

no test coverage detected