react / react/react-native

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

Đang mở
#45,001 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Issue: Author Provided Repro Needs: Triage :mag: Newer Patch Available
Ngôn ngữ chính
C++
Star
127k
Fork
25.3k
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
4

Mô tả

Description

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

Steps to reproduce
  • my app is running foreground service so when I repeat it about 30 times close -> open -> it causes a memory leak does the react native screen have an option to destroy the screen?
  • I keep the Android process running but when I close (swipe the app out normally in Android swipe the app out it would be killed) and open the app it increases the app memory do we have the option to destroy it?
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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với reproducer được liên kết và vòng đời của MainActivity trong khi dịch vụ foreground của Android đang chạy trên React Native 0.73.6. Lặp lại chu kỳ đóng và mở đã được báo cáo, đo mức lưu giữ bộ nhớ và xác định liệu MainActivity có tiếp tục bị giữ lại hay không; được xem là hoàn thành khi leak đã được cô lập với bằng chứng và hành vi vòng đời của nó đã được sửa hoặc được ghi lại rõ ràng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, react-native
Lĩnh vực
mobile, performance
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.