1

My emulators usually use 512MB or 1GB of RAM. I create a shell script which starts 8 emulators for my testing. Obviously, it will consume all of my available RAM.

Is there a way I tell emulator to use less RAM via console command? Some ad hoc RAM size which will not change the default RAM size.

I usually start emulators via (Ubuntu machine)

 emulator -avd "adb name" -scale 0.72
sandalone
  • 41,141
  • 63
  • 222
  • 338
  • For reference, a similar question was already asked (albeit with no proper answer): http://stackoverflow.com/questions/9322540 – ozbek Jan 12 '15 at 12:38

2 Answers2

1

I don't think that you can set the RAM through emulator command line parameters, but if you are starting your emulators with a script you can edit the emulator config.ini file before starting it.

On Ubuntu, the file should be located at ~/.android/avd/emulator.avd/config.ini. Before starting each emulator, open the corresponding config.ini file, set hw.ramSize to the desired value, save the change, and then launch your emulator with the new settings. A bit tedious, but I can't think of a better way.

Dalmas
  • 26,409
  • 9
  • 67
  • 80
  • I tried to avoid editing cinfig.ini for each emulator. I am doing it right now. That is why I asked if there is a command-line parameter – sandalone Jan 12 '15 at 12:46
1

Can we set emulator RAM size via console before we start emulator?

Yes, please use -memory option; e.g.:

emulator -memory 256 -avd Nexus_One_API_10 -scale 0.72
ozbek
  • 20,955
  • 5
  • 61
  • 84
  • How can I test if the device actually used 256RAM? I see memory resources consume more than 256MB RAM. Even more it consumes the same memory with or without this switch. – sandalone Jan 12 '15 at 12:54
  • `#cat /proc/meminfo` from emulator's adb shell. The actual host memory used by the emulator overall may also depend on other things than the RAM size. – ozbek Jan 12 '15 at 13:22
  • Hm, so decreasing RAM does not help me to run 8 emulators in the same time? – sandalone Jan 12 '15 at 15:11