A framework for building native applications using React
Improve API to take JS heap snapshots in Fantom (#53071)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53071 Changelog: [internal] The current API to take JS heap snapshots has some problems: 1. Ergonomics: it requires you to input the filepath where you want to store the snapshot. This isn't aligned with the behavior we have for JS traces where the output path is provided to you. 2. It doesn't work in optimized builds, as it requires a specific option in Hermes. For 1), this replaces `Fantom.saveJSMemoryHeapSnapshot(filePath)` with `Fantom.takeJSMemoryHeapSnapshot()` that outputs the snapshot in a predefined path and prints it to the console. For 2), this adds a new environment variable to force building Hermes with memory instrumentation (`FANTOM_ENABLE_JS_MEMORY_INSTRUMENTATION`). This is exposed as an option and not set by default because it has a performance overhead at runtime that we don't want to pay (especially in benchmarks). This option only works when using Buck in development, because we want to generate this new binary type on demand when necessary, instead of making it part of the prebuilts we do before running tests in OSS and CI. Reviewed By: lenaic Differential Revision: D79642314 fbshipit-source-id: a2980616a495bd6dca29c0709a9581db6fb3f2cc
R
Rubén Norte committed
789fc572543db799ef62dfd799c22c228be04c07
Parent: 2187f65
Committed by Facebook GitHub Bot <[email protected]>
on 8/6/2025, 12:40:02 PM