facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.48k stars 24.26k forks source link

[BUG] :: MainActivity memory leak when running foreground service #45001

Open chanphiromsok opened 3 months ago

chanphiromsok commented 3 months ago

Description

I have an issue with the app memory leak in MainActivity when running the foreground service the

Steps to reproduce

React Native Version

0.73.6

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (8) arm64 Apple M1
  Memory: 490.44 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.13.1
    path: ~/.asdf/installs/nodejs/20.13.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.asdf/installs/nodejs/20.13.1/bin/yarn
  npm:
    version: 10.5.2
    path: ~/.asdf/plugins/nodejs/shims/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/rom/.asdf/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11842104
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /Users/rom/.asdf/shims/javac
  Ruby:
    version: 2.7.8
    path: /Users/rom/.asdf/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

I don't have a stack trace because it is a memory leak

Reproducer

https://github.com/chanphiromsok/rnn-screen-leak

Screenshots and Videos

image

https://github.com/software-mansion/react-native-screens/assets/65760336/05f48f62-0394-43f1-8286-e2146c1b9822

github-actions[bot] commented 3 months ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.73.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.