I’m developing with React Native on Linux, and what I’m seeing is that, after I spin up an Android Studio emulator and Metro, my memory usage slowly creeps from a starting ~9 GB to nearly my full available 31 GB. This seems like a memory leak, as normally my machine can run a full development environment (for web development) with 30 dockerized services without issue.
I don’t think it’s the app itself, as we don’t see this issue on Mac/Windows, and the app itself runs fine – it’s my whole machine that crashes. Turning off the emulators lowers memory usage, but each time it goes back down to a higher number, so that eventually I’m at 75% even with the emulators and Metro off.
Does anyone have any insight as to what might be the issue here? I’m not sure if the leak is coming from Android Studio, the emulators specifically, or Metro.
2
Answers
It appears that this may have been a symptom of ignoring React Native's advice to install Watchman in the docs. They don't tell you what will happen if you don't, and we hadn't needed it on our Mac machines, so it wasn't part of our install process.
Still seeing memory spikes occasionally, but since installing Watchman memory's generally staying between 30-50% with a single simulator running.
I’m noticing that qemu-system-x86_64.exe started with 2k handles but now has 250k after a few hours of dev.
Speculating it’s something to do with hot reloading – super vague I know…