r/reactnative • • 2h ago

Help Developing on Mac, running android simulator is maxing my RAM

Hi,

I am developing a react native expo app on Macbook Air M4 with 16GB of RAM.

And whenever I am running an android simulator, either for actual build or for simulator its maxing my RAM, especially during the startup. After that it's sitting quite ok at about 5GB of RAM (which is still A LOT). But during the startup it can reach to 16GB of RAM.

I am using Android Studio built in Pixel 10 emulator.

Is there any alternative or something I am doing wrong here?

2 Upvotes

5 comments sorted by

2

u/XyrelTzy 2h ago

use pixel 6 or 7. In app development android emulator, jvm, java is the one consume more ram.

1

u/rsajdok 1h ago

Use for tests android phone

1

u/MobileXapps 1h ago

Close Android Studio while the emulator runs and start it from the terminal with emulator -avd <name>. The IDE itself takes a few GB on top of Gradle and the emulator.

In the AVD settings you can also lower the RAM and pick an older Pixel image without Play Store. And if you have any Android phone lying around, plug it in over USB, it costs your Mac basically nothing.

1

u/codariadev 1h ago

That startup spike is usually two things at once: the emulator cold booting and the first Gradle build. A few things that helped me on a 16 GB machine:

  • Don't run the full Android Studio just for the emulator. The IDE alone takes a few GB. You can start the AVD from the terminal: emulator -list-avds and then emulator -avd <name> (it's in ~/Library/Android/sdk/emulator).
  • Lower the AVD's RAM. In Device Manager > Edit > Advanced settings, set RAM to 2048 MB. The newest Pixel profiles default to a lot more than a dev build needs. An older profile (Pixel 6/7) with a "Google APIs" image instead of "Google Play" is lighter too.
  • Use Quick Boot instead of cold boot so it restores a snapshot instead of booting Android from scratch every time.
  • Cap Gradle's heap in android/gradle.properties (org.gradle.jvmargs=-Xmx2048m ...) if you're doing local builds, and avoid rebuilding when you don't need to. With a dev build installed, npx expo start only runs Metro, the native build isn't repeated.
  • Check Memory Pressure in Activity Monitor, not the "Memory Used" number. macOS fills RAM with cache and compressed memory, so 5 GB used while the pressure graph is green is fine.

If it's still painful, a cheap physical Android phone over USB is honestly the lightest option, zero emulator overhead.

1

u/dawedev 43m ago

If the 16GB spike is at startup, check that Quick Boot is on in the AVD settings so it resumes from a snapshot instead of cold booting every time. It also helps to let the emulator finish booting before you kick off the first Gradle build, otherwise both peak at the same moment.