facebook / facebook/hermes

Severe memory regression in V1

Open
#2,048 19 comments 11 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

Original issue: https://github.com/expo/expo/issues/46519

## Bug Description

After upgrading to Expo 56 and as a consequence Hermes v1, RAM memory usage almost doubled in my app.
I tried going back to SDK 55 and enabling the V1 Opt-In via Expo's `expo-build-properties`, and the memory increase is observed there too.

## Steps To Reproduce

Minimal reproducible example
https://github.com/rodperottoni/expo-sdk-56-mem-regression

Steps to reproduce
I have provided an example repository with a sandbox for both Expo SDK 56 and 55. The main branch is SDK 56, and the sdk-55 branch is SDK 55.
Checkout to each branch and run npm i --force + npm run compile + npm run ios.
Then, open the performance monitor as soon as the app opens.

## Findings

On SDK 56 RAM usage almost doubles in this basic example (149mb -> 266mb):

| SDK 55 | SDK 56 |
|--------|--------|
| Image | Image |

This increase is more noticeable in complex apps. In my employer's production app we've jumped from ~580mb up to 1.1GB in the home page of our app.

Further scenarios I tested:
- SDK 55 + `useHermesV1: true`: Increased RAM usage
- This scenario is in the `sdk-55-with-hermes-v1` branch of the example repo
- SDK 56 + `useHermesV1: false`: Increased RAM usage (disabling this flag seems to not do anything?)
- This scenario is in the `sdk-56-not-hermes-v1` branch of the example repo

## The Expected Behavior

Memory usage to remain the same or decrease. The React Native 0.84 release notes say:

> Automatic performance gains: All apps will use Hermes V1 by default, bringing improved execution speed and reduced memory usage.

Contributor guide

Open the contributing guide

Research direction

Start with the linked minimal reproducible example and compare its main, sdk-55, sdk-55-with-hermes-v1, and sdk-56-not-hermes-v1 branches. Run npm i --force, npm run compile, and npm run ios, then open the performance monitor to compare memory usage; done means explaining and correcting the SDK 56 regression without the reported near-doubling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.