react / react/react-native

[Android] - Higher memory usage on 0.85.x vs 0.83.x with the new Hermes (~25–30% more RAM, same app)

Đang mở
#57,059 23 bình luận 21 reaction 0 người được giao Xem trên GitHub

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

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

After upgrading an app from 0.83.9 → 0.85.3 with no application code changes (only the react-native / @react-native/* bump and the Hermes that ships with it), RAM usage is consistently ~25–30% higher across an identical scripted flow. It starts ~110 MB higher and widens to ~160 MB higher by the end of the run.

Both builds run the New Architecture + Hermes and the exact same third-party dependencies; the only meaningful difference is the React Native version (and therefore the bundled Hermes / "Hermes V1").

Environment

  • Platform: Android, physical device (Google Pixel 9 Pro, Android 16, arm64-v8a)
  • JS engine: Hermes (default, hermesEnabled=true)
  • Architecture: New Architecture (Fabric + TurboModules) enabled in both builds
  • Build type: release-optimized profileable build (Hermes bytecode, minified, debuggable=false)
  • Key deps (identical across both builds):
  • react-navigation 7, @shopify/flash-list 2, react-native-reanimated 4 + react-native-worklets, react-native-screens 4, react-native-gesture-handler 3
Steps to reproduce
  1. Build & install a release (profileable) APK on 0.83.9.
  2. Drive a fixed UI flow under measurement. I used Flashlight + a Maestro flow that scrolls a FlashList product feed, opens a product screen, taps a related item, and repeats 10×.
  3. Record RAM, then repeat on 0.85.3 with the same app code and flow.
# on 0.83.9
flashlight test --bundleId <app.id> --iterationCount <N> \
  --testCommand "maestro test flow.yaml" --resultsFilePath results_83.json

# on 0.85.3 (identical app code)
flashlight test --bundleId <app.id> --iterationCount <N> \
  --testCommand "maestro test flow.yaml" --resultsFilePath results_85.json

flashlight report results_83.json results_85.json
React Native Version

Regression between 0.83.9 and 0.85.3.

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info
System:
  OS: macOS 26.5
  CPU: (10) arm64 Apple M5
  Memory: 168.42 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.14.0
    path: /Users/josemaria.elias/.nvm/versions/node/v22.14.0/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.2
    path: /Users/josemaria.elias/.nvm/versions/node/v22.14.0/bin/npm
  Watchman:
    version: 2026.05.18.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/josemaria.elias/.gem/ruby/3.3.6/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.5
      - iOS 26.5
      - macOS 26.5
      - tvOS 26.5
      - visionOS 26.5
      - watchOS 26.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.3 AI-253.32098.37.2534.15336583
  Xcode:
    version: 26.5/17F42
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.19
    path: /usr/bin/javac
  Ruby:
    version: 3.3.6
    path: /Users/josemaria.elias/.rubies/ruby-3.3.6/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 20.1.0
    wanted: 20.1.0
  react:
    installed: 19.2.3
    wanted: 19.2.3
  react-native:
    installed: 0.85.3
    wanted: 0.85.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true
Stacktrace or Logs
Expected behavior
Comparable memory between 0.83.x and 0.85.x for the same workload (ideally lower, given the Hermes work).

Actual behavior
0.85.3 uses materially more RAM for the entire run — ~110 MB higher at start, ~160 MB higher by the end (~25–30%).

RN 0.83.9	RN 0.85.3	Δ
RAM at start	~370 MB	~480 MB	+~110 MB
RAM at end	~560 MB	~720 MB	+~160 MB


A snapshot breakdown via adb shell dumpsys meminfo <app.id> attributes the increase mainly to Native heap + Graphics, consistent with the engine/runtime + image buffers retaining more memory.
MANDATORY Reproducer

https://github.com/SirJalias/AwesomeProject

Screenshots and Videos
Image

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 AwesomeProject bắt buộc và chạy quy trình Flashlight và Maestro đã được ghi lại trên React Native 0.83.9 và 0.85.3. So sánh các tệp kết quả và đầu ra của adb shell dumpsys meminfo, tập trung vào các khác biệt được báo cáo ở Native heap và Graphics. Hoàn thành khi xác định được regression và chứng minh mức sử dụng bộ nhớ tương đương, hoặc ghi lại nguyên nhân đã được xác nhận kèm theo một regression test hoặc phép đo.

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
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/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.