Skip to content

Fatal Exception: java.lang.OutOfMemoryError #3841

@Siddhantshelake

Description

@Siddhantshelake

Description

We are seeing a production crash on Android related to memory exhaustion when using react-native-screens with Fabric (New Architecture) enabled.

The crash consistently points to:

NativeProxy.nativeAddMutationsListener during ScreensModule.setupFabric.

This appears to be a native memory issue (std::bad_alloc), potentially caused by mutation listeners or screen references accumulating over time.


Crash Stacktrace

Fatal Exception: java.lang.OutOfMemoryError
std::bad_alloc

com.swmansion.rnscreens.NativeProxy.nativeAddMutationsListener (NativeProxy.kt)
com.swmansion.rnscreens.ScreensModule.setupFabric (ScreensModule.kt:69)
com.swmansion.rnscreens.ScreensModule.onHostResume (ScreensModule.kt)

com.facebook.react.bridge.ReactContext$1.run (ReactContext.java:214)
android.os.Handler.handleCallback (Handler.java:995)
android.os.Handler.dispatchMessage (Handler.java:103)

com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage
android.os.Looper.loopOnce (Looper.java:273)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)

Steps to reproduce

  1. Enable New Architecture (Fabric) in React Native
  2. Use react-native-screens with React Navigation
  3. Navigate repeatedly between screens (push/pop flows)
  4. Send app to background and resume multiple times
  5. After extended usage, observe memory growth
  6. Eventually app crashes with OutOfMemoryError

Note: No minimal reproducible example yet — issue only observed in production over time.

Snack or a link to a repository

Not available (issue occurs only in production, not reproducible in minimal setup yet)

Screens version

4.18.0

React Native version

0.82.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

Real device

Device model

Samsung Galaxy Z Fold7 (Android 16) , Samsung Galaxy S26 Ultra (Android 16) , Samsung Galaxy S25 Ultra (Android 16)

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-reproThis issue need minimum repro scenarioplatform:androidIssue related to Android part of the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions