An investigation into why stale Shadow Nodes accumulate in React Native's Fabric architecture, causing memory to grow outside the JS heap where Hermes GC cannot see it. Shadow Node Wrappers — JS objects holding shared_ptr references to Shadow Nodes via jsi::NativeState — keep old tree revisions alive after views are unmounted. Because the retained memory sits outside the JS heap, Hermes GC has no visibility into it and doesn't collect it promptly. Two partial fixes were tested: forced periodic GC calls and setting memory pressure via setExternalMemoryPressure, but both have significant drawbacks. The root cause remains unresolved, and smaller apps with less JS garbage may be disproportionately affected.
171 Impressions