Repository navigation
Description
Description
The performance-timeline buffers grow without bound. Every performance.measure() call from JS (src/private/webapis/performance/Performance.js:62, cachedReportMeasure) reaches NativePerformance::reportMeasure (ReactCommon/react/nativemodule/webperformance/NativePerformance.cpp:158–166) → PerformanceEntryReporter::reportMeasure (ReactCommon/react/performance/timeline/PerformanceEntryReporter.cpp:206), which unconditionally appends the entry: measureBuffer_.add(entry) → PerformanceEntryKeyedBuffer::add → entryMap_[name].push_back(entry) (PerformanceEntryKeyedBuffer.cpp:13–24). There is no size cap, no eviction, and no lifecycle tie-in: the buffers (markBuffer_/measureBuffer_, PerformanceEntryReporter.h:120–121) belong to the process-lifetime PerformanceEntryReporter singleton, and the only drain path is an explicit JS performance.clearMarks()/clearMeasures() (PerformanceEntryReporter::clearEntries, PerformanceEntryReporter.cpp:168–179). Surface stop (stopSurface/unloadApp) leaves the timeline buffer intact.
Measured impact (react-native 0.83.6, bridgeless/Hermes, Android 17, dev-flavor debug build): over 20 push/pop navigation cycles of a plain content screen, the std::vector<std::variant<PerformanceMark, PerformanceMeasure, …>> behind PerformanceEntryKeyedBuffer::add grows +2.96 MB (2.935 MB in the sampled heapprofd diff; ~148 KB/cycle, ~15% of the app's per-cycle native slope) and is 100% retained through ReactDelegate.unloadApp()/stopSurface() + 4× forced Hermes GC — the only fully immortal allocation class in our accounting.
Trigger: on our rig the entries are produced by React's own renderer user-timing instrumentation — performance.measure(...) call sites ship in the dev/profiling renderer bundles (Libraries/Renderer/implementations/ReactFabric-dev.js, 17 call sites; ReactFabric-profiling.js; the prod bundle contains none) — so in a dev build every render appends entries that nothing ever removes. Any app or library calling performance.measure() without clearMeasures() accumulates the same way in any build type. The W3C performance-timeline model bounds stored entries (the maxBufferSize / dropped-entries mechanism browsers implement); this buffer has no such bound.
Environment
- react-native 0.83.6, react 19.2.0, new architecture / bridgeless, Hermes, Android 17 (Pixel 8 Pro + emulator); measured on a dev-flavor debug build (dev renderer active)
- class location: ReactCommon —
react/performance/timeline/,react/nativemodule/webperformance/
Repro
- Same rig as Fabric (Android, New Arch): unmounted host components' ShadowNodeWrapper set is never released — one popped screen's shadow subtree (createNode nodes + RawProps props) retained per navigation cycle; survives GC and stopSurface; ~1.0–1.5 MB/cycle #60210 (the ShadowNodeWrapper issue): 20 push/pop cycles of a plain content screen; heapprofd differential at c00-rest / c20-rest / post-
unloadApp. ThePerformanceEntryKeyedBuffer::addrow is the top single row of the c20−c00 diff (+2.935 MB) and shows 100% survival in the post-unload diff. - Minimal standalone: call
performance.measure(name)repeatedly withoutperformance.clearMeasures();PerformanceEntryKeyedBuffer::entryMap_[name]grows monotonically (each entry retains its name string and values) and survivesunloadApp().
Expected behavior
The timeline buffer should be bounded (per-name or total cap with drop-oldest + dropped-entries accounting, per the W3C timeline model) and/or cleared on surface stop / app unload. Process-long sessions that use the Performance API must not accumulate entries indefinitely.
Workaround
App-side mitigation exists: call performance.clearMeasures()/clearMarks() periodically (e.g. on navigation boundaries) to drain the buffers. (Unlike the shadow-graph class in #60210, which has no app-side mitigation.)
Separability
This class is disjoint from #60210's shadow-graph retention: different allocation sites (reporter buffer vs ShadowNode/props objects), different owner (PerformanceEntryReporter vs the wrapper-set/live-JS residue), and a different fix site (bound/trim the keyed buffer vs root-cause the wrapper residency). Fixing either does not affect the other.
Cross-references
- Fabric (Android, New Arch): unmounted host components' ShadowNodeWrapper set is never released — one popped screen's shadow subtree (createNode nodes + RawProps props) retained per navigation cycle; survives GC and stopSurface; ~1.0–1.5 MB/cycle #60210 — the ShadowNodeWrapper-pinned shadow-graph retention, measured in the same sessions (~620–700 KB/cyc of the same slope).
Activity
react-native-bot commentedon Nov 22, 2026
Warning
Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
You can read more about about it on our website: How to report a bug.