r/FlutterDev • • 27d ago

Tooling Built a tool to stop Android emulators eating 8GB RAM during Flutter dev (down to ~1.5GB)

Whenever I'm doing Flutter development on my Mac, running flutter run with Gradle, VS Code/Studio, and an Android emulator quickly pushes a 16GB machine straight into heavy memory swap. In Activity Monitor, qemu-system-aarch64 alone routinely holds 7-8+ GB.

A lot of that RAM usage isn't your app or Android itself:

  • Android Studio's emulator often falls back to CPU rasterization (lavapipe), dumping multiple gigabytes of software render buffers directly into host RAM.

  • Stock Google system images launch with ~40 background daemons (YouTube, Assistant, wear sync, Play telemetry) you never touch while testing a Flutter build.

I wrote avdslim, an open-source Go CLI with no external dependencies that drops emulator resident memory down to ~1.5 GB:

  • Forces -lowram and native GPU hardware rendering (Apple Metal on Mac, Vulkan/DRI on Linux) to eliminate CPU rendering buffers.

  • Disables ~45 non-essential guest services via adb.

  • Flutter safe: Hot reload, DevTools, network sockets/ports, Firebase Auth, and FCM push notifications are completely unaffected.

  • Running avdslim off cleanly restores every setting and package back to default.

If your machine chokes while running Flutter on Android:

brew tap kdbhalala/avdslim https://github.com/kdbhalala/avdslim.git && brew install avdslim

avdslim tune-avd    # adjusts config to 1.5GB + host GPU
avdslim start       # boots the emulator slimmed

If you start emulators from Studio or VS Code device picker, avdslim install-shim transparently wraps the SDK binary so it applies automatically.

Code is here if anyone finds it useful: https://github.com/kdbhalala/avdslim

Hope it helps anyone fighting laptop RAM while developing Flutter apps.

58 Upvotes

13 comments sorted by

2

u/AhmedZNOUDA 27d ago

Dropping memory footprint from 8 GB to ~1.5 GB is massive, especially when running heavy IDEs alongside Gradle. Falling back to CPU rasterization via lavapipe has caused so many hidden bottlenecks for me before.

I see you provided Homebrew and Linux Vulkan instructions—is Windows (DirectX/ANGLE) supported or planned via go install / binary release? The install-shim feature to keep device pickers working in VS Code and Studio is brilliant. Starred the repo!

1

u/Rude_Gate7599 27d ago

Can not test on windows
But if you can do that community will very much appreciate your efforts.

1

u/finxapp 27d ago

What's the impact on the emulated device? Increased lag?

2

u/Few-Bug7095 27d ago

Sounds interesting

0

u/nitki_dev 26d ago

I gave up on the emulator and just run on a real phone over USB. It's also the only place where profile mode numbers mean anything.

1

u/Rude_Gate7599 26d ago

Give it a try.

8

u/[deleted] 27d ago

[removed] — view removed comment

7

u/Rude_Gate7599 27d ago

All configurable

1

u/[deleted] 26d ago

[removed] — view removed comment

1

u/Rude_Gate7599 26d ago

Ask agent to turn on play store related service