react / react/react-native

Memory Leak with Fetch

Đang mở
#39,100 11 bình luận 26 reaction 0 người được giao Xem trên GitHub

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

🌐Networking Issue: Author Provided Repro Needs: Triage :mag:
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 encountered a memory leak issue when using the fetch function in my React Native application. The memory usage gradually increases over time in iOS, leading to performance degradation and potential crashes.

CleanShot 2023-08-22 at 09 33 37

React Native Version

0.72.4

Output of npx react-native info
  OS: macOS 13.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 758.45 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.0
    path: ~/.nvm/versions/node/v18.16.0/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/clemens/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10406996
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /usr/bin/javac
  Ruby:
    version: 2.7.5
    path: /Users/clemens/.rvm/rubies/ruby-2.7.5/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
Steps to reproduce
1.	Create a React Native project with the necessary dependencies.
2.	Implement a screen or component that utilizes the fetch function to make API requests.
3.	Monitor the memory usage of the application over an extended period.
4.	Observe that the memory usage consistently increases during and after making multiple fetch requests.
Snack, screenshot, or link to a repository

minimal example:
https://github.com/clemensmol/rn-fetch-memoryleak

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 bằng cách chạy ví dụ tối thiểu tại https://github.com/clemensmol/rn-fetch-memoryleak với React Native 0.72.4 trên iOS và theo dõi bộ nhớ trong khi thực hiện các yêu cầu fetch lặp lại. Theo dõi hành vi của yêu cầu và so sánh bộ nhớ trước và sau khi chạy trình tái hiện; được xem là hoàn tất khi mức tăng bộ nhớ được chứng minh đã được xử lý và bản tái hiện không còn cho thấy rò rỉ.

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

Đánh giá

Công nghệ
ios, javascript, react-native
Lĩnh vực
mobile
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/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.